Skip to content

Commit

Permalink
Fix bug where --host and --port don't work
Browse files Browse the repository at this point in the history
  • Loading branch information
christianbundy committed Jun 30, 2019
1 parent 888d015 commit fced88d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
})
Expand Down
9 changes: 6 additions & 3 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fced88d

Please sign in to comment.