Skip to content

Latest commit

 

History

History
26 lines (15 loc) · 1.09 KB

dotenv.md

File metadata and controls

26 lines (15 loc) · 1.09 KB

dotenv

Although dotenv is reliable, it may not be necessary or may lack certain features.

Alternatives

dotenvx

Modern and secure alternative by the same author. It supports encryption, and multi-environment configs.

Project Page npm

Node.js --env-file / --env-file-if-exists

Built into Node.js since v20.6.0 (v22.9.0 for --env-file-if-exists). Zero dependencies, good for simple use cases.

--env-file will raise an error if the env-file does not exist. For those cases, where the env-file might or might not exist, use --env-file-if-exists.

node --env-file=.env index.js

Also supported by tsx, Bun, and Deno.

Node docs: --env-file / --env-file-if-exists