Fix bug where --host and --port don't work

See: https://github.com/ssbc/ssb-config/issues/56
This commit is contained in:
Christian Bundy 2019-06-30 13:37:58 -07:00
parent 888d0152d6
commit fced88dcbd
No known key found for this signature in database
GPG Key ID: EB541AAEF4366237
2 changed files with 11 additions and 8 deletions

View File

@ -11,18 +11,18 @@ const config = yargs
default: true,
type: 'boolean'
})
.options('host', {
describe: 'hostname to listen on',
.options('web-host', {
describe: 'hostname for web app to listen on',
default: 'localhost',
type: 'string'
})
.options('port', {
describe: 'port to listen on',
.options('web-port', {
describe: 'port for web app to listen on',
default: 3000,
type: 'number'
})
.options('debug', {
describe: 'console debug output',
describe: 'verbose output for debugging',
default: false,
type: 'boolean'
})

View File

@ -42,11 +42,14 @@ module.exports = (config) => {
app.use(router.routes())
const uri = `http://${config.host}:${config.port}/`
app.listen(config.port)
const host = config['web-host']
const port = config['web-port']
const uri = `http://${host}:${port}/`
debug.enabled = true
debug(`Listening on http://${uri}`)
debug(`Listening on ${uri}`)
app.listen({ host, port })
if (config.open === true) {
open(uri)