Skip to content

Conversation

@majiayu000
Copy link

Fixes #1319

Changes

  • Add -env flag to CLI to read database connection string from environment variable
  • Add databaseFromEnv helper function with proper error handling for unset/empty env vars
  • Add unit tests for the new functionality

…able

Add support for reading the database connection string from an
environment variable specified by the -env flag. This security
enhancement allows users to avoid exposing connection strings
directly on the command line.

Usage: migrate -env DATABASE_URL -source file://path up
Signed-off-by: majiayu000 <[email protected]>
@coveralls
Copy link

Coverage Status

coverage: 54.412% (-0.02%) from 54.432%
when pulling 228c00c on majiayu000:fix-1319-support-reading-database-conne-0102-0049
into 257fa84 on golang-migrate:master.

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.

Support reading database connection string from environment variable

2 participants