-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
Improve the way .env
configuration file is loaded
#49514
Comments
This would be a breaking change, and by default opt-in as well as automatically detecting might create some serious security issues.
|
Hi @anonrig 👋 Thanks for the fast reply, that was just some suggestions 😉, after doing a few tests on my side. Feel free to close the issue if you think it's out of scope. Have a nice day! 🌤️ 🌿 |
Jumping here, as I was searching for something similar. For npm scripts specifically isn’t it a problem space that should be tackled by package managers like npm? 🤔 What led me here:I wanted to avoid using "build": "vite build --mode=production", to "build": "node --env-file=.env node_modules/vite/bin/vite vite build --mode=production", |
What is the problem this feature will solve?
Make environment variables configuration file loading more fluent.
What is the feature you are proposing to solve the problem?
Instead of loading it using a CLI command like
node --env-file .env
, it would be event better to use apackage.json
field containing the environment filename, this way, Node can automatically load the environment variables every time a NPM script is running.Another idea would be to let Node detect if a default
.env
file exists, and load it for each NPM script that is running. According to this idea, may be we could have a flag like--no-env-file
or--env-file none
to tell Node to not load environment file by default.This could be the default behavior.
What alternatives have you considered?
No response
The text was updated successfully, but these errors were encountered: