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

Override system variables #46

Closed
doasync opened this issue Sep 25, 2020 · 5 comments
Closed

Override system variables #46

doasync opened this issue Sep 25, 2020 · 5 comments

Comments

@doasync
Copy link

doasync commented Sep 25, 2020

What happens to environment variables that were already set?
We will never modify any environment variables that have already been set. In particular, if there is a variable in your .env file which collides with one that already exists in your environment, then that variable will be skipped. This behavior allows you to override all .env configurations with a machine-specific environment, although it is not recommended.

Add an option to ignore environment vars and set the variables from a file.

For example a user has NODE_ENV=development set in his system. Jest will fail on that. I want to be able to ignore system vars and set explicitly all variables that I need for my script/command (NODE_ENV=test)

@entropitor
Copy link
Owner

@doasync Is there an option to do this using dotenv (from where you linked the documentation)?

If not, I think it's out of scope for this package.

I'm gonna close it for now, but feel free to link to documentation / open a PR and I'll re-open this ticket.

@doasync
Copy link
Author

doasync commented Sep 25, 2020

There is a feature request in dotenv:
motdotla/dotenv#436

@ghost
Copy link

ghost commented Oct 14, 2020

If anyone is looking for an override option, I've added it in a new package dotenv-override-cli.

@entropitor I'd be happy to contribute a PR to this repo adding the feature if you'd like (and deprecate my package). To implement an override option I didn't need any changes to dotenv, but did need to make changes to dotenv-expand. I resorted to bundling a patched version of dotenv-expand in my package because they don't seem to be actively accepting PRs.

@mobula9
Copy link

mobula9 commented Jan 17, 2022

Hello,

The override feature is now available in dotenv v14.1.0 (#46)

It would be great to get this feature available in dotenv-cli also.

@jfairley
Copy link
Contributor

jfairley commented Apr 5, 2023

I've made a PR for this at #87.

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

4 participants