Advanced

dotenvx.config()

Use directly in node.js code.

# .env
HELLO="World"
// index.js
require('@dotenvx/dotenvx').config()

console.log(`Hello ${process.env.HELLO}`)
$ node index.js
[[email protected]] injecting env (1) from .env
Hello World

It defaults to looking for a .env file.