Skip to content

billylaing/env-get

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Simple utility to get environment variables with an optional default.

Resources

Stars

Watchers

Forks

Packages

No packages published