Skip to content

docs: document environment variables and .env loading - #838

Closed
MrBeldum wants to merge 1 commit into
amacneil:mainfrom
MrBeldum:docs/issue-500-env-vars-readme
Closed

MrBeldum wants to merge 1 commit into
amacneil:mainfrom
MrBeldum:docs/issue-500-env-vars-readme

Conversation

@MrBeldum

Copy link
Copy Markdown
Contributor

Summary

Adds a dedicated Environment Variables README section covering:

  • Default .env loading from the current working directory
  • --env-file for one or more alternate dotenv files
  • Table of settings → CLI flags → environment variables (from main.go EnvVars)
  • Precedence: CLI flag > process environment > dotenv files > built-in defaults
  • Database URL resolution: --url, then the variable named by --env (default DATABASE_URL)

Verified against loadEnvFiles and urfave/cli flag definitions in main.go / tests in main_test.go.

Fixes #500

Test plan

  • Cross-check env var names against EnvVars: in main.go
  • Cross-check .env / --env-file behavior against TestLoadEnvFiles
  • Cross-check URL precedence against TestGetDatabaseUrl

Add a README section covering dotenv loading (--env-file), the mapping
from settings to environment variables, and precedence between CLI flags,
process environment, dotenv files, and defaults.

Verified against loadEnvFiles and flag EnvVars in main.go.

Fixes amacneil#500
@MrBeldum

Copy link
Copy Markdown
Contributor Author

Closing as duplicate of #837 (same issue #500; opened by a parallel worker). Please review #837.

@MrBeldum MrBeldum closed this Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a section to the README documenting how environment variables are used by dbmate

1 participant