-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathconfig.js
More file actions
50 lines (44 loc) · 892 Bytes
/
config.js
File metadata and controls
50 lines (44 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
'use strict';
var nconf = require('nconf');
//
// Most of the time you want to pass in a relative path to
// a single config file defaulting to ./browsenpm.config.json
//
var options = {
config: {
description: 'Config file to load on startup',
alias: 'c',
string: true,
default: __dirname + '/config.json'
}
};
//
// CLI arguments should override.
//
nconf.argv(options).env();
/**
* Simple configuration fetcher and updater.
*
* @constructor
* @api private
*/
function Configuration() {
//
// Now load the file potentially passed in from
// --config|-c
//
nconf.file({ file: this.get('config') });
}
/**
* Retrieve a value from the configuration.
*
* @param
* @api public
*/
Configuration.prototype.get = function get() {
return nconf.get.apply(nconf, arguments);
};
//
// Expose the module as singleton.
//
module.exports = new Configuration;