Advanced
dotenvx.config()
Use directly in node.js code.
# .env
HELLO="World"
// index.js
require('@dotenvx/dotenvx').config()
// or import '@dotenvx/dotenvx/config' if you're using esm
console.log(`Hello ${process.env.HELLO}`)
$ node index.js
⟐ injected env (1) from .env
Hello World
It defaults to looking for a .env file.
Advanced
- config(path: ['.env.local', '.env'])
- config(overload: true)
- config(mask: true)
- config(quiet: true)
- config(strict: true)
- config(ignore: ['.env.missing', '.env'])
- config(envKeysFile: '../../.env.keys')
- config(convention: 'nextjs')
- config(path: directory, convention: 'nextjs')
- config(noArmor: true)
- config(no1Password: true)
- config(noBitwarden: true)