Skip to content

Add option to process.loadEnvFile to not throw if no .env was foundΒ #61086

@simhnna

Description

@simhnna

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    dotenvIssues and PRs related to .env file parsingfeature requestIssues that request new features to be added to Node.js.

    Type

    No type

    Projects

    Status

    Awaiting Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions