1.0.0 • Published 8 years ago
dotyaml v1.0.0
dotyaml
Override NodeJS environment variables with .yaml file.
Getting Started
Step #1: Install
$ npm install --save dotyamlStep #2: Load the configuration
require("dotyaml")();Step #3: Retrieve the value
console.log(process.env.MONGO_HOST); // localhost
console.log(process.env.MONGO_PORT); // 27017Example .yaml content
mongo_host: localhost
mongo_port: 27017Custom index in .yaml file.
Example .yaml content with custom index.
env:
mongo_host: localhost
mongo_port: 27017Load the configuration with custom index.
require("dotyaml")("env");Retrieve as above
console.log(process.env.MONGO_HOST); // localhost
console.log(process.env.MONGO_PORT); // 270171.0.0
8 years ago