Skip to content

[Docs] process.loadEnvFile() does not document behaviour when variables already exist #66315

Description

@lonix1

Affected URL(s)

https://nodejs.org/docs/latest/api/process.html#processloadenvfilepath

Description of the problem

The documentation for process.loadEnvFile(path) states that the .env file is loaded into process.env, but does not document what happens when a variable already exists in process.env.

The --env-file documentation states that an existing environment variable takes precedence over a value from the file.

process.loadEnvFile() appears to have the same behaviour, but this is not stated in its API documentation.

Please document the precedence behaviour for process.loadEnvFile(), for example:

If a variable is already defined in process.env, its existing value takes precedence and is not overwritten by the value from the .env file.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to Node.js documentation.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions