zenconfig
Simple schema-based configuration for twelve-factor apps
Note: this package is currently in beta.
Features
- 12-factor ready: encourages portable configuration via environment vars
- Schema based: define options via json compatible schema
- Independent: look ma, no dependencies
- Immutable: creates a read-only config object for your sanity
Install
npm install zenconfig
Usage
const zenconfig = require('zenconfig')
// Define configuration schema
const schema = {
"NODE_ENV": {
"type": "string",
"default": "development"
},
"PORT": {
"type": "number",
"default": 8080
},
"HOST": {
"type": "string"
}
}
// Create immutable configuration from environment
const config = zenconfig(schema, process.env)
License
This software is released under the MIT license, see LICENSE.