alternative defaults: .env.defaults
#29
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have a use case where I can't use
.env
file as defaults easily, without intricate measures, transition periods, automated scripts migrating.env
to.env.local
etc. (migrating fromdotenv
on a shared repo with multiple devs constantly working on it)I can expect that it might be difficult to convince you to add this feature, I tried to explain the reasoning, but I am not too good at writing docs - so if you find this useful, any suggestions how to describe it better would be very welcome...
Below is the new paragraph from README:
Alternative defaults:
.env.defaults
In addition to
.env
, you may also use.env.defaults
to store default (fallback) values.This may come handy e.g. when migrating from dotenv (where it is strongly advised against committing
.env
file to VCS)and you already have
.env
file used to store your local values.In such case, you may prefer to keep using your existing
.env
(ignored by VCS) as your local configand create additional
.env.defaults
(tracked by VCS) file which will be loaded before.env
.Then at every place
.env
is mentioned in the docs, read it as: ".env.defaults
first, then.env
".