-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
comments in .env files are parsed as values #52759
Comments
It is already fixed in #52406 |
I tested the latest command .env
index.js output Observation Proposal
CC: @anonrig @climba03003 |
Please reopen if needed. |
any update when this will be fixed? facing the same issue on current LTS v20.13.1 |
Double checked with the above repro in comments. |
This was fixed in v20.13.0. I verified with the reproduction in the OP. If you have another way to reproduce, please open a new issue. |
.env (example)
Sorry, I was on node just fixed the node version issue, the above Thank you |
Version
20.12.0+, 21.0.0+, 22.0.0
Platform
Darwin XXX.local 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000 arm64
Subsystem
No response
What steps will reproduce the bug?
Run with single env file:
nvm run 20.6.0 --env-file=.env index.js
=>OK
nvm run 20.11.1 --env-file=.env index.js
=>OK
nvm run 20.12.0 --env-file=.env index.js
=>WRONG2
nvm run 22.0.0 --env-file=.env index.js
=>WRONG2
Run with multiple env files:
nvm run 20.11.1 --env-file=.env --env-file=.env.local index.js
=>OK
nvm run 20.12.0 --env-file=.env --env-file=.env.local index.js
=>WRONG3
nvm run 22.0.0 --env-file=.env --env-file=.env.local index.js
=>WRONG3
Note: for simplicity I re-used the .env file, but using different files yields the same behaviour
How often does it reproduce? Is there a required condition?
Works as long as
--env-file
is presentWhat is the expected behavior? Why is that the expected behavior?
I expect only uncomment values in .env files to be parsed as actual values. So the output of the reproduction script should be "OK". This is in-line with every other .env parsing library. Also node v20.6.0 -> v20.11.1 behaves like that:
What do you see instead?
The last read commented values is outputed instead of the expected value:
Additional information
No response
The text was updated successfully, but these errors were encountered: