--env-file

A Node.js command-line flag that loads variables from a .env file into process.env before your code runs, with no package needed.

In more detail

Each line of the file is NAME=value. The flag can be given several times, and a later file overrides an earlier one, so node --env-file=.env --env-file=.env.local app.js lets local values win. Variables already set in the real environment take precedence over the files, and --env-file-if-exists skips files that are missing.

Related terms

Taught in

References