Closed thanosd closed 8 months ago
@thanosd can you switch to
Move from left to right, and if something exists "first one wins" unless override is set.
that is what dotenvx
is doing.
thank you for all your hard work here @thanosd. it's really contributing to making dotenv much better for everyone.
@motdotla Updated as requested. Little had to change in the code structure, as we need to hold a copy of the combined parsed object to return it.
thank you. i should merged and released today.
All modified and coverable lines are covered by tests :white_check_mark:
:exclamation: No coverage uploaded for pull request base (
master@85dbe87
). Click here to learn what that means.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I cleaned up the code a bit to first gather a list of files (that exist) in a uniform way. The logic is as close as to what existed:
options.path
has one or more options use those..env
.The next step is to parse and combine those values - flattening them. The sequence would be:
existing env -> options.path[0] (if exists) -> options.path[1] -> etc
There were two choices here:
override
is set.existing env
honoring theoverride
flag.I went with (2) as I did not deem the
override
semantics made sense when collapsing multiple environment files - but let me know if you disagree.Also cleaned up the docs to reflect this.