-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.js
More file actions
30 lines (27 loc) · 819 Bytes
/
config.js
File metadata and controls
30 lines (27 loc) · 819 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
var commander = require( 'commander' ),
defaults = require( './defaults.js' ),
logger = require( './logger.js' ),
prop,
config;
commander
.version( '0.0.1' )
.option( '-c, --config <path>', 'Path to the local configuration file' )
.option( '-d, --debug', 'Run unminified code and skip auth check')
.parse( process.argv );
try {
if ( commander.config ) {
config = require( commander.config );
for ( prop in defaults ) {
if ( defaults.hasOwnProperty( prop ) && !config.hasOwnProperty( prop ) ) {
config[prop] = defaults[prop];
}
}
} else {
config = defaults;
}
config.debug = commander.debug;
} catch(err) {
logger.error( 'Could not open configuration file ' + commander.config + '! ' + err );
process.exit( 1 );
}
module.exports = config;