React Native AutoLink
Config builder for Node projects. Merges environment variables with default config object(s) to produce simple config object and allows all config options to be overridable via environment variables.
Installation
npm install make-conf --save
Behavior
All keys are converted to camel-case and nested appropriately based on the following rules:
- Single underscore -> camel-case (e.g.
NODE_ENV
becomesnodeEnv
) - Double underscore -> nested object (e.g.
APP__NAME
becomesapp.name
)
After converting keys, values are merged:
- Objects are merged recursively
- All other values (e.g. arrays, strings) are replaced
Usage
Pass in any config sources to get merged config result.
const makeConf = ; // Using a default objectconst conf = // Using folder of YAML filesconst conf = ; // Example// Environment variables: NODE_ENV=production APP__VERSION=2.0.0const conf = ;// { nodeEnv: 'production', app: { name: 'makeConf', version: '2.0.0' }}