Small, zero dependency, hierarchical node.js configuration with files, environment variables, command-line arguments, and atomic object merging.
 
Go to file
indexzero 0fd847cc33 [doc] Updates to README.md 2011-04-02 04:59:18 -04:00
docs [doc] Add docco docs 2011-04-02 04:42:26 -04:00
lib [test] More tests for nconf 2011-04-02 04:41:50 -04:00
test [doc] Updates to README.md 2011-04-02 04:59:18 -04:00
.gitignore [doc] Updates to README.md 2011-04-02 04:59:18 -04:00
README.md [doc] Updates to README.md 2011-04-02 04:59:18 -04:00
usage.js [doc] Updates to README.md 2011-04-02 04:59:18 -04:00

README.md

nconf

A hybrid local / remote configuration storage library for node.js.

Installation

Installing npm (node package manager)

  curl http://npmjs.org/install.sh | sh

Installing nconf

  [sudo] npm install nconf

Usage

Using nconf is easy; it is designed to be a simple key-value store with support for both local and remote storage. Keys are namespaced and delimited by :. Lets dive right into sample usage:

  var fs    = require('fs'),
      nconf = require('nconf');
  
  //
  // Setup nconf to user the 'file' store and set a couple of values;
  //
  nconf.use('file', { file: 'path/to/your/config.json' });
  nconf.set('database:host', '127.0.0.1');
  nconf.set('database:port', 5984);
  
  //
  // Get the entire database object from nconf
  //
  var database = nconf.get('database');
  
  //
  // Save the configuration object to disk
  //
  nconf.save(function (err) {
    fs.readFile('path/to/your/config.json', function (err, data) {
      console.dir(JSON.parse(data.toString()))
    });
  });

Storage Engines

Memory

File

Redis

More Documentation

Run Tests

Tests are written in vows and give complete coverage of all APIs and storage engines.

  vows test/*-test.js --spec

Author: Charlie Robbins