0.3.0 • Published 11 years ago

env-config v0.3.0

Weekly downloads
38
License
-
Repository
github
Last release
11 years ago

Env Config

read configuration from environment variables.

Install

npm install https://github.com/snd/env-config.git

Use

envConfig = require 'env-config'

specification =
    port: 'int'
    mysqlUser: 'string'
    mysqlPassword: 'string'
    logInfo: 'bool'

environment =
    PROJECT_NAME_PORT: '8080'
    PROJECT_NAME_MYSQL_USER: 'foo'
    PROJECT_NAME_MYSQL_PASSWORD: 'bar'
    PROJECT_NAME_LOG_INFO: 'true'

config = envConfig 'PROJECT_NAME_', specification, environment

console.log config

# =>  {
#       port: 8080,
#       mysqlUser: 'foo',
#       mysqlPassword: 'bar',
#       logInfo: true 
#   }

License

MIT