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