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

Support multiple .env files? #4

Closed
laggingreflex opened this issue Sep 12, 2016 · 3 comments
Closed

Support multiple .env files? #4

laggingreflex opened this issue Sep 12, 2016 · 3 comments

Comments

@laggingreflex
Copy link

Thoughts on supporting multiple .env files?

@toddbluhm
Copy link
Owner

Yeah I certainly would be open to that. Maybe have it support merging too in the style of Object.assign? Thoughts?

@toddbluhm
Copy link
Owner

I think if we go this route we will need to do some sort of flag style then so we know exactly when the user has stopped adding env files and we can retain the default behavior (no flags) that is very simplistic and I like that. So maybe something like this for multiple files: env-cmd -e file1.env file2.env file3.env -c node index.js maybe?

Then for the merging aspect, the file to the right will always override the file to the left, meaning that the files will be applied to process.env in order from left -> right.

@laggingreflex
Copy link
Author

laggingreflex commented Oct 22, 2016

I've changed my mind on this. Most tools I've come across expect (even advocate) single env file. Docker by default not only recognizes a single .env, it also requires less configuration, whereas its support for having any other file name, let alone multiple of them, is limited.

For this reason I've chosen to go with single .env file, and if need be combine several beforehand.

Also I realized I could just chain env-cmd command to load multiple files:

env-cmd .env-dev env-cmd .env-test npm run tests 

Thanks for taking interest in this. Really appreciate it.

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