56
loading...
This website collects cookies to deliver better user experience
require('dotenv').config()
it will populate all .env variables in process.env object# with npm
npm install dotenv
# or with Yarn
yarn add dotenv
require('dotenv').config()
DB_HOST=localhost
DB_USER=root
DB_PASS=s1mpl3
const db = require('db')
db.connect({
host: process.env.DB_HOST,
username: process.env.DB_USER,
password: process.env.DB_PASS
})
"test:unit": "dotenv -e .env.testing -- npm run test:unit",
"test:e2e": "dotenv -e .env.testing -- npm run test:e2e",
$ npm install -g dotenv-cli
$ yarn global add dotenv-cli
$ dotenv <command with arguments>
$ dotenv -e .env2 <command with arguments>
$ dotenv -e .env3 -e .env4 <command with arguments>