4.1.4 • Published 7 years ago
multi-dotenv v4.1.4
mulit-dotenv
This is a fork of dotenv that adds support for multiple environment variable files.
Install
npm install multi-dotenv --save
Usage for multiple files
As early as possible in your application, require and configure dotenv.
require('dotenv').multi()
Place any number of files with .env
extension in the root directory of your project. Add
environment-specific variables on new lines in the form of NAME=VALUE
.
For example:
DB_HOST=localhost
DB_USER=root
DB_PASS=s1mpl3
That's it.
process.env
now has the keys and values you defined in your ALL your .env
files.
var db = require('db')
db.connect({
host: process.env.DB_HOST,
username: process.env.DB_USER,
password: process.env.DB_PASS
})
``