Add option to process.loadEnvFile to not throw if no .env was found
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 122k
- Forks
- 37.3k
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 283
Description
What is the problem this feature will solve?
Most of my uses are for local development where I have a .env file. When actually deployed to production all variables are configured by prefixing the command, configuring k8s/docker variables, ... but almost never with a .env file. I think most people would want it to fail silently if no file was found. I'm not sure if you want to change that default in the next major version, but IMO at least a flag should be added
Also that's how dotenv behaved where I guess most node users would be switching from...
What is the feature you are proposing to solve the problem?
change signature to
function loadEnvFile(path?: string, { ignoreMissingFile?: boolean })
What alternatives have you considered?
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the process.loadEnvFile entry point and inspect how its current arguments and missing-file errors are handled. Add the proposed ignoreMissingFile option while preserving the existing behavior by default, then verify that a missing .env file is ignored only when the option is enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100