-
Notifications
You must be signed in to change notification settings - Fork 51
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 .env, .env.local, .env.<environment> practice #37
Comments
@plashenkov so basically you would want a flag like |
Yep, usually these files participate in this flow:
Files on the left have more priority than files on the right. I.e. if And real environment variables always win over env vars created by any of the .env files: SOMEVAR=somevalue dotenv --cascade -- <command with arguments> SOMEVAR=somevalue should take the top precedence. |
Where |
@plashenkov the problem is that we should probably not read out What could work is something like |
I think that's great. Probably we shouldn't use 'development' by default since sometimes 'dev' can be used (in Symfony for example). Maybe if omitted we should just ignore |
@plashenkov That makes sense! You want to take a stab at it? |
Sorry I'm not so fluent in English. :) What does "want to take a stab at it" mean? |
Ah sorry, I meant to ask if you want to try implementing this feature and make a pull request? |
Yep, I think I'll try. Nearest days. |
Ok, done. Is it okay for you to update the help text and readme? |
Is it okay to use -c instead of --cascade? |
Hey!
Thanks for this awesome lib!
It would be nice if
dotenv-cli
could read variables from multiple.env
files. There is a common approach to use.env
and.env.local
, and maybe.env.<environment>
(.env.production
,.env.development
, etc.) schema.Here are the examples:
It's a common and nice practice since you can use common defaults in an
.env
file and then override them in a machine-specific.env.local
. Usually you commit.env
to a git repository and do not commit.env.local
(secrets go there).Currently we can use
-e envfile
many times, but it would be nice to have, for example, a special argument to activate this schema:The text was updated successfully, but these errors were encountered: