Skip to content

Commit

Permalink
fix(gatsby-cli): use host option if it is passed (#11566)
Browse files Browse the repository at this point in the history
## Description

The serve command didn't use the "--host" option and just used localhost.
It got deleted in commit bff0cd3

## Related Issues

Related to #8080
  • Loading branch information
zauni authored and DSchau committed Feb 5, 2019
1 parent 368cb72 commit ec15b04
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/gatsby/src/commands/serve.js
Expand Up @@ -8,7 +8,7 @@ const preferDefault = require(`../bootstrap/prefer-default`)
const chalk = require(`chalk`)

module.exports = async program => {
let { prefixPaths, port, open } = program
let { prefixPaths, port, open, host } = program
port = typeof port === `string` ? parseInt(port, 10) : port

const config = await preferDefault(
Expand All @@ -31,8 +31,8 @@ module.exports = async program => {
})
app.use(pathPrefix, router)

const server = app.listen(port, () => {
let openUrlString = `http://localhost:${port}${pathPrefix}`
const server = app.listen(port, host, () => {
let openUrlString = `http://${host}:${port}${pathPrefix}`
console.log(
`${chalk.blue(`info`)} gatsby serve running at: ${chalk.bold(
openUrlString
Expand Down

0 comments on commit ec15b04

Please sign in to comment.