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

Variable in multiple .env files not supported #495

Open
trek opened this issue Mar 5, 2018 · 1 comment
Open

Variable in multiple .env files not supported #495

trek opened this issue Mar 5, 2018 · 1 comment

Comments

@trek
Copy link

trek commented Mar 5, 2018

I'm a bit confused about the exact timing and provenance of this but:

The guides say "Variables defined in an deploy-target specific file will override those defined in a top-level .env file."

There's even a code comment about ordering being important here.

But the dotenv project contradicts this "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."

I'm seeing the behavior described in the dotenv README, but would love someone to verify. If it's actually been removed I'd be happy to PR either their example work-around (that they suggest avoiding) or PR removing this from the guides.

@ghedamat
Copy link
Collaborator

ghedamat commented Mar 5, 2018

Hey @trek

It's been a while since I last touched this but,
this should be the correct order of precedence

  • first your ENV already has the variable (i.e. by setting it inline MYVAR=foo ember deploy production)
  • second you have a .env.deploy.production env available (if you're deploying to the production deployTarget)
  • third you have a .env file in your project

in this order the variables will be loaded and will not be overridden if one of the previous steps on the list has already defined them

I do agree that the documentation around this should be better

Let me know if this helps!

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

2 participants