envv

1.2.0 • Public • Published

envv

CircleCI codecov js-semistandard-style npm License MIT Bitcoin Donate

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)
};
  1. listenAddr will be process.env.ADDR or 127.0.0.1
  2. if process.env.PORT is not given, Error: env var 'PORT' is missing will be thrown

Package Sidebar

Install

npm i envv

Weekly Downloads

3

Version

1.2.0

License

MIT

Unpacked Size

8.91 kB

Total Files

8

Last publish

Collaborators

  • aluxian