Maps environment variables to JS types.
Example
Environment
Object;
Mapping
const parse types = ;const string boolean array number = types; const mapping = use: redis: cluster: use: hosts: mongo: host: port: db: options: readPreference: un: host: port: darray: ;
Mapped Config
const config = ;
Result
// const config will be use: false redis: cluster: use: true hosts: host: '127.0.0.1' port: 6371 host: '127.0.0.2' port: 6372 mongo: host: '127.0.0.1' port: 27017 db: 'somedb' options: readPreference: 'secondary' un: host: null port: null darray: dvalue: 22 svalue: 'one' dvalue: 21 svalue: null
Available Types
string(defaultValue)
number(defaultValue)
boolean(defaultValue)
array(length, itemType, defaultValue)
Instead of given types, any function like the following can be used
{ // do something to the value return transformentValueOfEnvVar;}