Skip to content
This repository has been archived by the owner on Jul 24, 2020. It is now read-only.
/ env0 Public archive
forked from dshaw/env

Sadly dshaw ignored our (fully tested) pull request updating his module ... GOTO: dwyl/env2

Notifications You must be signed in to change notification settings

dwyl/env0

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Env - In your environment managing your variables.

Build Status Test Coverage Code Climate Dependency Status devDependency Status npm

Managing environment variables can be a pain. Env helps make that better.

Module status

Env is an evolving project based which came out of discussions with @joemccann and @clintandrewhall. I don't consider this package fully baked yet.

Get Env.

npm install env

Usage

Add an env.json file to your repo.

{
  "DB_HOST": 1,
  "DB_PORT": 1,
  "DB_USER": 1,
  "DB_PASS": 1
}
var env = require('env')()

env.ok(function(err) {
  if (!err) return
  console.error(err)
  process.exit(1)
})

// Yes, it's SYNC, so you can do this too!

function handleEnv (err) {
  if (!err) return
  process.exit(1)
}

if (env.ok(handleEnv)) {
  var port = env.get('SETUP_PORT')
  server.listen(port)
}

Env is sync like require, so it's tasks can be accomplished before app execution.

Follow dshaw

About

Sadly dshaw ignored our (fully tested) pull request updating his module ... GOTO: dwyl/env2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%