2011-03-31 06:32:47 +00:00
|
|
|
/*
|
|
|
|
* nconf.js: Top-level include for the nconf module
|
|
|
|
*
|
2014-11-26 06:31:48 +00:00
|
|
|
* (C) 2011, Charlie Robbins and the Contributors.
|
2011-03-31 06:32:47 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2017-10-21 20:01:01 +00:00
|
|
|
var common = require('./nconf/common'),
|
2015-09-20 07:34:44 +00:00
|
|
|
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
|
|
|
|
2011-11-23 02:22:09 +00:00
|
|
|
//
|
|
|
|
// Setup all stores as lazy-loaded getters.
|
|
|
|
//
|
2020-06-02 10:15:06 +00:00
|
|
|
['env', 'file', 'literal', 'memory'].forEach(function (store) {
|
2017-08-16 03:39:34 +00:00
|
|
|
var name = common.capitalize(store);
|
2012-04-14 19:28:55 +00:00
|
|
|
|
2017-08-16 03:39:34 +00:00
|
|
|
nconf.__defineGetter__(name, function () {
|
|
|
|
return require('./nconf/stores/' + store)[name];
|
|
|
|
});
|
2011-11-23 02:22:09 +00:00
|
|
|
});
|
|
|
|
|
2011-04-02 07:03:16 +00:00
|
|
|
//
|
2011-05-14 05:47:26 +00:00
|
|
|
// Expose the various components included with nconf
|
2011-04-02 23:17:04 +00:00
|
|
|
//
|
2011-09-16 10:49:47 +00:00
|
|
|
nconf.key = common.key;
|
|
|
|
nconf.path = common.path;
|
|
|
|
nconf.loadFiles = common.loadFiles;
|
|
|
|
nconf.loadFilesSync = common.loadFilesSync;
|
|
|
|
nconf.formats = require('./nconf/formats');
|
2011-11-23 02:22:09 +00:00
|
|
|
nconf.Provider = Provider;
|