๐Ÿ“ฆ billylaing / env-get

Simple utility to get environment variables with an optional default.

โ˜… 2 stars โ‘‚ 0 forks ๐Ÿ‘ 2 watching
๐Ÿ“ฅ Clone https://github.com/billylaing/env-get.git
HTTPS git clone https://github.com/billylaing/env-get.git
SSH git clone git@github.com:billylaing/env-get.git
CLI gh repo clone billylaing/env-get
Billy Laing Billy Laing Merge pull request #19 from billylaing/dependabot/npm_and_yarn/coveralls-3.0.11 07c17b5 5 years ago ๐Ÿ“ History
๐Ÿ“‚ master View all commits โ†’
๐Ÿ“ lib
๐Ÿ“ tests
๐Ÿ“„ .babelrc
๐Ÿ“„ .eslintignore
๐Ÿ“„ .eslintrc.json
๐Ÿ“„ .gitignore
๐Ÿ“„ .npmignore
๐Ÿ“„ circle.yml
๐Ÿ“„ package.json
๐Ÿ“„ README.md
๐Ÿ“„ README.md

env-get

Simple utility to get environment variables with an optional default. Throws an error if the variable is not found and no default is supplied.

This utility was designed to support twelve-factor applications and the strict separation of code and config. Read more about it here.

NPM Version NPM Monthly Test Status Coverage Status

Usage:

const env = require('env-get');

// PORT not set
const port = env.get('PORT', 4000);
console.log(port); // 4000

// TOKEN not set
const token = env.get('TOKEN'); // throws Error 

// HOSTNAME set
const hostname = env.get('HOSTNAME'); 
console.log(hostname); // blaing.io