stores.js

Jump To …
nconf/common.html nconf/formats.html nconf/provider.html nconf/stores/file.html nconf/stores/memory.html nconf/stores/system.html nconf/stores.html nconf.html

# stores.js |
--- | ---
¶ |
    /*
     * stores.js: Top-level include for all nconf stores
     *
     * (C) 2011, Charlie Robbins
     *
     */

    var fs = require('fs'),
        common = require('./common'),
        stores = exports;
¶ Setup all stores as lazy-loaded getters. |
    fs.readdirSync(__dirname + '/stores').forEach(function (file) {
      var store = file.replace('.js', ''),
          name  = common.capitalize(store);

      stores.__defineGetter__(name, function () {
        return require('./stores/' + store)[name];
      });
    });