-
Notifications
You must be signed in to change notification settings - Fork 503
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
Allow loading multiple dotenv files #1748
Comments
it would be super useful to be able to override the default values of the .env using a .env.local !! |
This would be great, many project use multiple dotenvs and I have to use bash scripts every time |
how about allowing more then on dotenv-filename config?
and
if they can be evaluated in order, last one wins. I was reading the code and I think updating the config to allow an vec of filenames and then modifying the current dotenv load process might be a smaller change. The code path would always be used making it less likely to have diverging behaviors. one could even skip supporting the command line part and make it a set config only. [edit] https://gist.github.com/sbeckeriv/664c3dd8a38c84c877a45f50d44a0f20 While making this diff I learned that |
If we're going to allow multiple dotenv files, it seems like requiring them all to be in a single
Question, though: how should this setting work with fallback justfiles? |
Related: #945 (comment)
It would be great to be able to source multiple dotenv files in a "cascading" manner, similar to https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use. This allows per-environment overrides, and a
.env
to provide defaults to fall back on (meaning.env.test
,.env.qa
,.env.prod
don't need to repeat the same common env vars that can be defined once in.env
).I think there may be some related work that would need to be done to be able to interpolate filenames in
dotenv-files
, though.And call with
just ENV=prod
to load env vars from.env.prod
, and then.env
(assuming dotenv files don't overwrite existing environment variables).As far as behavior goes, it probably makes sense to fail silently (or log it) if a file in the array isn't found since they can just be "candidates" for dotenv files to load. For example,
.env.local
may not always be present in an environment, but we'll try to load it if it does happen to exist.The text was updated successfully, but these errors were encountered: