You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was wondering if there's a way to prevent a .env file from overwriting an existing env var. Consider the following example:
❯ cat .env
FOO="Using .env"
❯ FOO="Using FOO from shell" forego run -e .env env | grep FOO
FOO=Using .env
Ideally, if FOO is already set, I don't think a .env file should overwrite it, like if the environment variable gets set at runtime in a docker-compose.yml, k8s, or whatever orchestrator may be setting them.
Similarly this would be helpful when passing multiple .env files for different environments for example:
# FOO should still be "Using FOO from shell"
❯ FOO="Using FOO from shell" forego run -e .env -e .env.dev -e .env.local env | grep FOO
FOO=Using .env.local
# FOO gets overwritten by every subsequent .env file specified
❯ forego run -e .env -e .env.dev -e .env.local env | grep FOO
FOO=Using .env.local
It seems that right now the last file parsed will always take over an environment variable previously set, but it would be nice if there was an option to prevent them from being overriden.
A proposed solution might look something like this:
❯ FOO="Using FOO from shell" forego run --no-env-overwrite -e .env -e .env.dev -e .env.local env | grep FOO
FOO=Using FOO from shelll
The text was updated successfully, but these errors were encountered:
I was wondering if there's a way to prevent a .env file from overwriting an existing env var. Consider the following example:
Ideally, if FOO is already set, I don't think a .env file should overwrite it, like if the environment variable gets set at runtime in a docker-compose.yml, k8s, or whatever orchestrator may be setting them.
Similarly this would be helpful when passing multiple .env files for different environments for example:
It seems that right now the last file parsed will always take over an environment variable previously set, but it would be nice if there was an option to prevent them from being overriden.
A proposed solution might look something like this:
The text was updated successfully, but these errors were encountered: