diff --git a/packages/gatsby-cli/README.md b/packages/gatsby-cli/README.md index 5010b610ba401..f97fe8cbf8790 100644 --- a/packages/gatsby-cli/README.md +++ b/packages/gatsby-cli/README.md @@ -78,12 +78,12 @@ development server. #### Options -| Option | Description | Default | -| :-------------: | ----------------------------------------------- | :------------------: | -| `-H`, `--host` | Set host. | `localhost` | -| `-p`, `--port` | Set port. | `env.PORT` or `8000` | -| `-o`, `--open` | Open the site in your (default) browser for you | | -| `-S`, `--https` | Use HTTPS | | +| Option | Description | Default | +| :-------------: | ----------------------------------------------- | :-----------------------: | +| `-H`, `--host` | Set host. | `env.HOST` or `localhost` | +| `-p`, `--port` | Set port. | `env.PORT` or `8000` | +| `-o`, `--open` | Open the site in your (default) browser for you | | +| `-S`, `--https` | Use HTTPS | | Follow the [Local HTTPS guide](https://www.gatsbyjs.org/docs/local-https/) to find out how you can set up an HTTPS development server using Gatsby. diff --git a/packages/gatsby-cli/src/create-cli.ts b/packages/gatsby-cli/src/create-cli.ts index dcee342521f69..ede5a1e61b23a 100644 --- a/packages/gatsby-cli/src/create-cli.ts +++ b/packages/gatsby-cli/src/create-cli.ts @@ -144,8 +144,10 @@ function buildLocalCommands(cli: yargs.Argv, isLocalSite: boolean): void { _.option(`H`, { alias: `host`, type: `string`, - default: defaultHost, - describe: `Set host. Defaults to ${defaultHost}`, + default: process.env.HOST || defaultHost, + describe: process.env.HOST + ? `Set host. Defaults to ${process.env.HOST} (set by env.HOST) (otherwise defaults ${defaultHost})` + : `Set host. Defaults to ${defaultHost}`, }) .option(`p`, { alias: `port`,