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

Comments in .env aren't ignored by loadEnvFile() #52362

Closed
steffen-4s1 opened this issue Apr 4, 2024 · 1 comment
Closed

Comments in .env aren't ignored by loadEnvFile() #52362

steffen-4s1 opened this issue Apr 4, 2024 · 1 comment
Labels
confirmed-bug Issues with confirmed bugs. dotenv Issues and PRs related to .env file parsing

Comments

@steffen-4s1
Copy link

steffen-4s1 commented Apr 4, 2024

Version

20.12.0

Platform

Linux xxx 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

Description

process.loadEnvFile() doesn't ignore (first) comment line.

What steps will reproduce the bug?

Create an example .env file with two comments

#FOO=123
#BAR=456

and run the following code snippet

process.loadEnvFile();

console.log("FOO", process.env.FOO);
console.log("BAR", process.env.BAR);

Example repo: https://github.com/steffen-4s1/dotenv

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

Always

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

All comment lines should be ignored.

FOO undefined
BAR undefined

What do you see instead?

FOO isn't ignored.

FOO 123
BAR undefined

Additional information

No response

@VoltrexKeyva VoltrexKeyva added the dotenv Issues and PRs related to .env file parsing label Apr 4, 2024
@anonrig anonrig added the confirmed-bug Issues with confirmed bugs. label Apr 5, 2024
@anonrig
Copy link
Member

anonrig commented Apr 5, 2024

Duplicate #52084

@anonrig anonrig closed this as not planned Won't fix, can't repro, duplicate, stale Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. dotenv Issues and PRs related to .env file parsing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants