Fix bug where --host and --port don't work
See: https://github.com/ssbc/ssb-config/issues/56
This commit is contained in:
parent
888d0152d6
commit
fced88dcbd
10
index.js
10
index.js
|
@ -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'
|
||||
})
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue