Fix bug where --host and --port don't work
See: https://github.com/ssbc/ssb-config/issues/56
This commit is contained in:
10
index.js
10
index.js
@ -11,18 +11,18 @@ const config = yargs
|
|||||||
default: true,
|
default: true,
|
||||||
type: 'boolean'
|
type: 'boolean'
|
||||||
})
|
})
|
||||||
.options('host', {
|
.options('web-host', {
|
||||||
describe: 'hostname to listen on',
|
describe: 'hostname for web app to listen on',
|
||||||
default: 'localhost',
|
default: 'localhost',
|
||||||
type: 'string'
|
type: 'string'
|
||||||
})
|
})
|
||||||
.options('port', {
|
.options('web-port', {
|
||||||
describe: 'port to listen on',
|
describe: 'port for web app to listen on',
|
||||||
default: 3000,
|
default: 3000,
|
||||||
type: 'number'
|
type: 'number'
|
||||||
})
|
})
|
||||||
.options('debug', {
|
.options('debug', {
|
||||||
describe: 'console debug output',
|
describe: 'verbose output for debugging',
|
||||||
default: false,
|
default: false,
|
||||||
type: 'boolean'
|
type: 'boolean'
|
||||||
})
|
})
|
||||||
|
@ -42,11 +42,14 @@ module.exports = (config) => {
|
|||||||
|
|
||||||
app.use(router.routes())
|
app.use(router.routes())
|
||||||
|
|
||||||
const uri = `http://${config.host}:${config.port}/`
|
const host = config['web-host']
|
||||||
app.listen(config.port)
|
const port = config['web-port']
|
||||||
|
const uri = `http://${host}:${port}/`
|
||||||
|
|
||||||
debug.enabled = true
|
debug.enabled = true
|
||||||
debug(`Listening on http://${uri}`)
|
debug(`Listening on ${uri}`)
|
||||||
|
|
||||||
|
app.listen({ host, port })
|
||||||
|
|
||||||
if (config.open === true) {
|
if (config.open === true) {
|
||||||
open(uri)
|
open(uri)
|
||||||
|
Reference in New Issue
Block a user