JavaScript, Node

qconf 0.2 released

qconf is painless configuration for Node apps with defaults file, environment variables, arguments, function parameters.

defaults file < process.env < command line arguments < function call override

Install qconf and kick the tires:

$ npm install --save qconf

New in 0.2:

  • The config object is now an event emitter, so you can easily log when a value is undefined, without sprinkling logic throughout your code. Listen for the undefined event:
    var qconf = require('qconf'),
      config = qconf(),
      util = require('util');
    config.on('undefined', function (msg, attr) {
      // or build a custom message:
      util.log('WAT? Can't find ' + attr);
    // Logs:
    // "WARNING: Undefined environment variable: some_var"
    // "WAT? Can't find some_var"
  • qconf.clear() method that will clear your existing configuration so that you can load a fresh one with a subsequent call to qconf().

There’s a quick getting started guide on the previous announcement, and of course, the qconf repository on GitHub


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s