From 7c8bf1a46b1eb08cb23216582ceae312e1c63fa6 Mon Sep 17 00:00:00 2001 From: Ian Sutherland Date: Sun, 14 Jan 2018 12:14:37 -0700 Subject: [PATCH] Add warning when HOST environment variable is set (#3730) * Add warning when HOST environment variable is set (#3719) * Improve HOST environment variable warning message * Adjust text and message Closes #3719 --- scripts/start.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/start.js b/scripts/start.js index 7eb7ad464c0..3ff1b91f435 100644 --- a/scripts/start.js +++ b/scripts/start.js @@ -51,6 +51,21 @@ 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.cyan( + `Attempting to bind to HOST environment variable: ${chalk.yellow( + chalk.bold(process.env.HOST) + )}` + ) + ); + console.log( + `If this was unintentional, check that you haven't mistakenly set it in your shell.` + ); + console.log(`Learn more here: ${chalk.yellow('http://bit.ly/2mwWSwH')}`); + console.log(); +} + // 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)