Licence
MIT
Version
1.0.0
Deps
1
Vulns
0
Weekly
0
dotyaml
Override NodeJS environment variables with .yaml file.
Getting Started
Step #1: Install
$ npm install --save dotyaml
Step #2: Load the configuration
require("dotyaml")();
Step #3: Retrieve the value
console.log(process.env.MONGO_HOST); // localhost
console.log(process.env.MONGO_PORT); // 27017
Example .yaml content
mongo_host: localhost
mongo_port: 27017
Custom index in .yaml file.
Example .yaml content with custom index.
env:
mongo_host: localhost
mongo_port: 27017
Load the configuration with custom index.
require("dotyaml")("env");
Retrieve as above
console.log(process.env.MONGO_HOST); // localhost
console.log(process.env.MONGO_PORT); // 27017