1.0.0 • Published 6 years ago
dotyaml v1.0.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
1.0.0
6 years ago