envv
v1.2.0
Published
Simple util for config files that checks and returns an env var.
Downloads
41
Maintainers
Readme
envv
Simple util for config files that checks and returns an env var.
Installation
$ npm install envvUsage
// config.js
const envv = require('envv');
module.exports = {
listenAddr: envv('ADDR', '127.0.0.1'), // (1)
listenPort: envv('PORT') // (2)
};listenAddrwill beprocess.env.ADDRor127.0.0.1- if
process.env.PORTis not given,Error: env var 'PORT' is missingwill be thrown
