env-config

0.3.0 • Public • Published

env-config

Build Status

env-config reads configuration for twelve-factor-apps from environment variables.

install

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:

envConfig = require 'env-config'
 
specification =
    port: 'int'
    mysqlUser: 'string'
    mysqlPassword: 'string'
    logInfo: 'bool'
    provisionRate: 'float'
 
envConfig 'MY_PROJECT'specificationprocess.env
 
# =>  { 
#       port: 8080, 
#       mysqlUser: 'foo', 
#       mysqlPassword: 'bar', 
#       logInfo: true 
#       provisionRate: 0.2 
#   } 

the first parameter (prefix to all environment variables) is optional.

envConfig throws an exception if an environment variable is empty or can't be converted to the specified type.

license: MIT

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.3.010latest

Version History

VersionDownloads (Last 7 Days)Published
0.3.010
0.2.10
0.2.00
0.1.00

Package Sidebar

Install

npm i env-config

Weekly Downloads

10

Version

0.3.0

License

none

Last publish

Collaborators

  • snd