Skip to content
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

--env-file parser overrides variables with commented out values #52084

Closed
egorFiNE opened this issue Mar 14, 2024 · 2 comments
Closed

--env-file parser overrides variables with commented out values #52084

egorFiNE opened this issue Mar 14, 2024 · 2 comments
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. dotenv Issues and PRs related to .env file parsing

Comments

@egorFiNE
Copy link

Version

v21.7.1

Platform

Darwin gray.local 23.4.0 Darwin Kernel Version 23.4.0: Wed Feb 21 21:45:49 PST 2024; root:xnu-10063.101.15~2/RELEASE_ARM64_T6020 arm64

Subsystem

env parser

What steps will reproduce the bug?

Create .env:

VAR=first

# SOMETHING=else
# VAR=second

Run the testcase:

node --env-file=.env -e 'console.log(process.env.VAR)'

The output is second instead of first.

Adding a non-commented variable after # SOMETHING makes the parser work correctly.

How often does it reproduce? Is there a required condition?

100% reproduction

What is the expected behavior? Why is that the expected behavior?

Commented-out line of .env is ignored.

What do you see instead?

Commented-out part is parsed and the variable value is overwritten.

Additional information

env parser works correctly in 21.6.2, emitting first in console.

@IlyasShabi
Copy link
Contributor

I can reproduce the bug, I believe that the regression may have been introduced by this #51289
I will fix it asap

@mertcanaltin mertcanaltin added the c++ Issues and PRs that require attention from people who are familiar with C++. label Mar 15, 2024
@VoltrexKeyva VoltrexKeyva added the dotenv Issues and PRs related to .env file parsing label Mar 15, 2024
@IlyasShabi
Copy link
Contributor

@anonrig could you please close this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. dotenv Issues and PRs related to .env file parsing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants