Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: Add environment variable support for migrations directory. #329

Open
timuckun opened this issue Apr 11, 2022 · 8 comments · Fixed by #337
Open

feature request: Add environment variable support for migrations directory. #329

timuckun opened this issue Apr 11, 2022 · 8 comments · Fixed by #337
Labels

Comments

@timuckun
Copy link

Currently there are the options for

GOOSE_DRIVER=DRIVER
GOOSE_DBSTRING=DBSTRING

It should also support a env var for migrations directory.

It should also detect and process a .env file if one exists.

@mfridman
Copy link
Collaborator

Hmm, I can't think of a good reason why there is no env option for the migrations directory.

Not sure about processing .env though. I think most users will have something like https://github.com/direnv/direnv, https://www.npmjs.com/package/dotenv (or equivalent) to load/unload env variable.

So as long as goose understands just the env variables it should be sufficient.

@timuckun
Copy link
Author

Reading the .env file would be convenient when using it as a CLI.

I know you can use other software on top but it seems like an easy feature to add and would be very convenient.

@mfridman
Copy link
Collaborator

Opened a PR to add this env variable GOOSE_MIGRATION_DIR.

I'm not entirely sold on adding .env support into goose directly. I think .env, .envrc, etc. are a solved problem outside CLI's, but I could be wrong.

I'm inclined to leave it as an env variable for now, but we can always revisit this if more folks ask for it and use something like: https://github.com/joho/godotenv

@VojtechVitek
Copy link
Collaborator

@BatuhanW
Copy link

BatuhanW commented Sep 16, 2022

If not .env, having something like .gooseconfig file that we can configure would be really nice.

$ cat .gooseconfig

GOOSE_DRIVER=postgres
GOOSE_DBSTRING="host=localhost user=docker password=docker dbname=docker sslmode=disable"

@hiendaovinh
Copy link

Please and dotenv processing.

@mfridman mfridman reopened this Dec 18, 2023
@mfridman
Copy link
Collaborator

Re-opening this issue so we can track its popularity, and differentiate it from #347 (which is mainly about variable replacement, and less about reading .env files)

@mansguiche
Copy link

.env support would be useful for me

Even if it was an optional flag that was disabled by default, e.g. goose up -env=".env"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants