konf

Runtime configuration for node.js apps

Konf

A runtime configuration loader for node apps.

npm install konf

It's purpose is to allow moving seamlessly from configuration files to process.env variables. When deploying to SaaS platforms like Heroku/Nodejitsu/etc non-versioned file uploads are not a possibility. Konf allows you to fallback to environment variables without any changes to your code.

It's also self-documenting, so users installing your application have clear instructions to follow:

var Konf = require('konf')

var config = new Konf().describe({
    appDomain: "The application domain/host name"
  , authCallback: "OAuth callback"
  , twitter: {
        key: "Twitter API key"
        secret: "Twitter API secret"
  }
}).load('./config').env()

This will attemp to populate the given config values first from ./config.(js|json|coffee) file and then from properties on process.env. Environment keys are automatically converted from camelCase to snake_case, and are case-insensitive.

MIT