Comparing version 0.1.0 to 0.2.0
{ | ||
"name": "env-config", | ||
"description": "parse configuration options from environment variables", | ||
"description": "read configuration from environment variables", | ||
"author": "Maximilian Krüger <kruemaxi@googlemail.com> (http://github.com/snd)", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"repository": { | ||
@@ -7,0 +7,0 @@ "type": "git", |
@@ -1,11 +0,23 @@ | ||
# Env Config | ||
# Env config | ||
read [configuration](http://www.12factor.net/config) from environment variables. | ||
read [config](http://www.12factor.net/config) from environment variables. | ||
### Install | ||
npm install https://github.com/snd/env-config.git | ||
npm install env-config | ||
### Use | ||
given some environment variables: | ||
``` | ||
MY_PROJECT_PORT=8080 | ||
MY_PROJECT_MYSQL_USER=foo | ||
MY_PROJECT_MYSQL_PASSWORD=bar | ||
MY_PROJECT_LOG_INFO=true | ||
MY_PROJECT_PROVISION_RATE=0.2 | ||
``` | ||
use them in your application: | ||
```coffeescript | ||
@@ -20,12 +32,4 @@ envConfig = require 'env-config' | ||
environment = | ||
PROJECT_NAME_PORT: '8080' | ||
PROJECT_NAME_MYSQL_USER: 'foo' | ||
PROJECT_NAME_MYSQL_PASSWORD: 'bar' | ||
PROJECT_NAME_LOG_INFO: 'true' | ||
console.log envConfig 'MY_PROJECT', specification, process.env | ||
config = envConfig 'PROJECT_NAME_', specification, environment | ||
console.log config | ||
# => { | ||
@@ -35,8 +39,9 @@ # port: 8080, | ||
# mysqlPassword: 'bar', | ||
# logInfo: true | ||
# logInfo: true | ||
# provisionRate: 0.2 | ||
# } | ||
``` | ||
### License | ||
`envConfig` throws an exception if an environment variable is empty or can't be converted to the specified type. | ||
MIT | ||
### License: MIT |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
6059
46