Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gatsby-cli): added HOST environment variable #26712

Merged
merged 6 commits into from
Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/gatsby-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 4 additions & 2 deletions packages/gatsby-cli/src/create-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand Down