Skip to content

Commit

Permalink
Add warning when HOST environment variable is set (facebook#3719)
Browse files Browse the repository at this point in the history
  • Loading branch information
iansu committed Jan 10, 2018
1 parent 58e31f9 commit 1f2c4be
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/react-scripts/scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,19 @@ if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000;
const HOST = process.env.HOST || '0.0.0.0';

if (process.env.HOST) {
console.log(
chalk.yellow(
"Attempting to bind to $HOST because it was specified. If this was unintentional, check that you haven't mistakenly set it in your shell."
)
);
console.log(
chalk.cyan(
'https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#advanced-configuration\n'
)
);
}

// We attempt to use the default port but if it is busy, we offer the user to
// run on a different port. `choosePort()` Promise resolves to the next free port.
choosePort(HOST, DEFAULT_PORT)
Expand Down

0 comments on commit 1f2c4be

Please sign in to comment.