1.0.0-beta.1 • Published 8 years ago

zenconfig v1.0.0-beta.1

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

zenconfig

Simple schema-based configuration for twelve-factor apps

npm Travis Codecov Code Climate dependencies license

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.