-
Notifications
You must be signed in to change notification settings - Fork 29.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
Add a feature to parse .env file by default #51413
Comments
This would of course introduce a security issue bad enough that we will probably never have this behavior as default. However there might be other ways to solve the problem at hand.
Can you give a specific example where this is a problem, ideally in the form "expected behavior vs actual behavior". |
@aduh95 |
/cc @anonrig |
Please do not do this. We have projects that make use of an |
I'll open a PR for adding a function similar to dotenv.config() |
Does not work, an error occurs: |
Was there a solution loading environment variables from .env when running npx? I don't see a solution in the linked PR. There is a related issue against npm/cli |
It would be amazing if it worked with npx |
What is the problem this feature will solve?
As of now current NodeJS requres to explicitly specify path to .env file whereas dotenv makes it by default. Users have to run scripts starting with
node
keyword to explicitly specify .env file path. Whereasnpm
ornpx
commands do not support--env-file
flag to pass it to node. For users who wants to exclude useage of external dotenv it seems inconvenient.What is the feature you are proposing to solve the problem?
In order to get rid of dotenv library I propose to parse
.env
file if it exests in project root folder.What alternatives have you considered?
Switching back to dotenv
The text was updated successfully, but these errors were encountered: