Closed thanosd closed 6 months ago
it should be a
. this is work we wrote up in the README before quite finishing.
a PR would be very welcome. thank you @thanosd !
I'll spin one out later today. If I also implemented (b) in a more backwards compatible way, would there be interest?
my mistake. i meant to say b. Fix the code, to perform what is described in the README
. the behavior should match the README. the README was written ahead of the behavior in this case.
OK, I can do that too, but that will take me a day :). Any concerns or changing the implementation? If yes, we could mitigate by adding a flag mergeMultipleFiles, defaulting to false, which would be the current behavior.
this was a very new implementation (https://github.com/motdotla/dotenv/commit/f46336f3efce2ea202f73aaaccc26b727d1e92ee), so no concerns.
Came here to report this same issue, I'm glad someone took a look at it
Took a stab at a PR. Feedback welcome.
released as v16.4.3
. big thanks to @thanosd for making dotenv even better for the community!
Readme.md
says this about passing files:Pass in multiple files as an array, and they will be loaded in order. The first value set for a variable will win.
This implies that all files are loaded, and if a variable is specified in multiple files the first instance wins.
However, it seems the behavior is "Open the first file that exists and stop".
Two possible fixes:
a) Fix the readme to describe the current behavior. b) Fix the code, to perform what is described in the README. This would cause a change in behavior that may be unexpected for some (though useful for others).
Happy to produce a PR, but thoughts on direction before I do so?