crushlovely/envbang-node

View on GitHub
README.md

Summary

Maintainability
Test Coverage
# EnvBang for Node.js

[![NPM Version](http://img.shields.io/npm/v/envbang-node.svg?style=flat)](https://www.npmjs.org/package/envbang-node)
[![Dependency Status](http://img.shields.io/gemnasium/crushlovely/envbang-node.svg?style=flat)](https://gemnasium.com/crushlovely/envbang-node)
[![Build Status](http://img.shields.io/travis/crushlovely/envbang-node.svg?style=flat)](https://travis-ci.org/crushlovely/envbang-node)
[![Code Climate](http://img.shields.io/codeclimate/github/crushlovely/envbang-node.svg?style=flat)](https://codeclimate.com/github/crushlovely/envbang-node)
[![Code Coverage](http://img.shields.io/codeclimate/coverage/github/crushlovely/envbang-node.svg?style=flat)](https://codeclimate.com/github/crushlovely/envbang-node)

Ensure you have all the right environment variables set in your app.


## Installation & Usage

As early as possible in your application require envbang and pass it your required environment variables.

``` javascript
EnvBang = require('envbang-node');
envbang = new EnvBang(['NODE_ENV', 'PORT', 'MONGOHQ_URL']);
// Once initialized, run #check() to ensure your environment variables are present
envbang.check();
```

If you are missing any environment variables, envbang will throw an error and give you a list of the variables you're missing:

``` bash
The following required environment variables are missing:
=> NODE_ENV
=> PORT
=> MONGOHQ_URL
```

## Inspiration

This package is meant to be used as a companion to [dotenv-node](https://github.com/crushlovely/dotenv-node). We are big fans of configuration via environment variables, but it can occasionally get a little crazy when you have a team of developers trying to keep up with changes to a `.env` file. The goal is to give clear feedback on application configuration to help reduce developer confusion and frustration.

### References

* [The Twelve Factor App](http://12factor.net/config)
* [jcamenisch/ENV_BANG](https://github.com/jcamenisch/ENV_BANG) - the original, written in Ruby

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

## Running tests

```bash
npm install
npm test
```