-
Notifications
You must be signed in to change notification settings - Fork 50
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
.env.local should have higher priority than .env.<environment> #73
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
#37 added support for
--casacade
, which allows.env
,.env.local
,.env.<environment>
,.env.<environment>.local
to override each other in priority. The PR references Create React App, NextJS, and Symfony for the priority order.However, the priority order in
dotenv-cli
doesn't match Create React App or NextJS, which I believe is a bug.NextJS and Create React App both use the following priority, with
.env.local
values overriding those in.env.development
:.env.development.local
(Highest).env.local
.env.development
.env
(Lowest)(NextJS .env docs here, CRA docs here - note the second section, under "Files on the left have more priority than files on the right")
The CRA source also includes a comment that references bkeepers/dotenv which specifies the same priority in their readme. The NextJS source doesn't include the comment but the implementation is very similar.
Symfony, however, swaps
.env.local
and.env.development
, giving.env.development
priority (and looks like this is what @plashenkov modeled the behavior in #37). I think this is actually a bug in Symfony, since the PR that added this behavior references CRA and bkeepers/dotenv, so it looks like they made a mistake in the implementation.It would be great if
dotenv-cli
could match Create React App and NextJS, I'm happy to submit a PR for this if you're open to it!The text was updated successfully, but these errors were encountered: