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

Prevent existing environment variables from being overriden? #233

Open
evandam opened this issue Apr 7, 2022 · 0 comments
Open

Prevent existing environment variables from being overriden? #233

evandam opened this issue Apr 7, 2022 · 0 comments

Comments

@evandam
Copy link

evandam commented Apr 7, 2022

Hey @nickstenning thanks for this project!

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 FOO from .env"

$ FOO="Using FOO from shell" honcho run -e .env env | grep FOO
FOO=Using .env.local

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:

❯ honcho run -e .env.local,.env.dev,.env env | grep FOO
FOO=Using .env

It seems that right now the last file parsed will always take over an environment variable previously set, but it would be nice if it didn't override them.

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

No branches or pull requests

1 participant