Skip to content

Commit

Permalink
🐛 Fix #9 . Allow to use conf.json as parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
yael committed Mar 13, 2017
1 parent e8b1313 commit bd7b09f
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions bin/spacebro
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ program
.option('-M, --mute', 'option to hide informations')
.option('--semiverbose', 'do not show events datas in logs')
.option('-H, --hidedashboard', 'Allow to hide dashboard')
.option('-C, --config [value]', 'give a path to config.json file')
.option('-C, --config [path]', 'give a path to config.json file')

program.name = 'spacebro'

Expand All @@ -36,14 +36,22 @@ const config = program.config
? require(path.resolve(process.cwd(), program.config))
: {}

config.showdashboard = (typeof program.hidedashboard === undefined) ? true : !program.hidedashboard
if (!config.showdashboard) {
config.showdashboard = (typeof program.hidedashboard === undefined) ? true : !program.hidedashboard
}

config.server = {
port: Number(program.port) || 8888,
serviceName: program.servicename || 'spacebro'
if (!config.server) {
config.server = {
port: Number(program.port) || 8888,
serviceName: program.servicename || 'spacebro'
}
}

config.verbose = (program.mute === undefined) ? true : false
config.semiverbose = program.semiverbose
if (!config.verbose) {
config.verbose = (program.mute === undefined) ? true : false
}
if (!config.semiverbose) {
config.semiverbose = program.semiverbose
}

spacebro.init(config)

0 comments on commit bd7b09f

Please sign in to comment.