nconf-lite/lib/nconf.js

41 lines
991 B
JavaScript
Raw Normal View History

/*
* nconf.js: Top-level include for the nconf module
*
2014-11-26 06:31:48 +00:00
* (C) 2011, Charlie Robbins and the Contributors.
*
*/
2017-10-21 20:01:01 +00:00
var common = require('./nconf/common'),
Provider = require('./nconf/provider').Provider;
//
// `nconf` is by default an instance of `nconf.Provider`.
//
var nconf = module.exports = new Provider();
2011-05-17 02:44:46 +00:00
//
2013-12-02 06:21:21 +00:00
// Expose the version from the package.json
2011-05-17 02:44:46 +00:00
//
2013-12-02 06:21:21 +00:00
nconf.version = require('../package.json').version;
2011-04-19 21:34:42 +00:00
//
// Setup all stores as lazy-loaded getters.
//
['env', 'file', 'literal', 'memory'].forEach(function (store) {
var name = common.capitalize(store);
2012-04-14 19:28:55 +00:00
nconf.__defineGetter__(name, function () {
return require('./nconf/stores/' + store)[name];
});
});
//
// Expose the various components included with nconf
//
nconf.key = common.key;
nconf.path = common.path;
nconf.loadFiles = common.loadFiles;
nconf.loadFilesSync = common.loadFilesSync;
nconf.formats = require('./nconf/formats');
nconf.Provider = Provider;