Always set NODE_ENV to production (#12010)

Using the --dev flag is the only support way to change the internal
Kibana environment to something else. Allowing NODE_ENV to be set at all
can have unexpected results with our dependencies, so we now always set
it to production.
This commit is contained in:
Court Ewing 2017-05-26 11:27:16 -04:00 committed by GitHub
parent b8b597338e
commit 04e829d457
6 changed files with 14 additions and 3 deletions

View file

@ -21,4 +21,4 @@ if [ ! -x "$NODE" ]; then
exit 1
fi
exec "${NODE}" $NODE_OPTIONS --no-warnings "${DIR}/src/cli" ${@}
NODE_ENV=production exec "${NODE}" $NODE_OPTIONS --no-warnings "${DIR}/src/cli" ${@}

View file

@ -21,4 +21,4 @@ if [ ! -x "$NODE" ]; then
exit 1
fi
exec "${NODE}" $NODE_OPTIONS --no-warnings "${DIR}/src/cli_plugin" "$@"
NODE_ENV=production exec "${NODE}" $NODE_OPTIONS --no-warnings "${DIR}/src/cli_plugin" "$@"

View file

@ -7,6 +7,8 @@ for %%I in ("%SCRIPT_DIR%..") do set DIR=%%~dpfI
set NODE=%DIR%\node\node.exe
set NODE_ENV="production"
WHERE /Q node
IF %ERRORLEVEL% EQU 0 (
for /f "delims=" %%i in ('WHERE node') do set SYS_NODE=%%i

View file

@ -7,6 +7,8 @@ for %%I in ("%SCRIPT_DIR%..") do set DIR=%%~dpfI
set NODE=%DIR%\node\node.exe
set NODE_ENV="production"
WHERE /Q node
IF %ERRORLEVEL% EQU 0 (
for /f "delims=" %%i in ('WHERE node') do set SYS_NODE=%%i

View file

@ -38,3 +38,10 @@ This is no longer the case. Now, only commas are a valid query separator: e.g. `
*Details:* Kibana 6.0.0 and onward only support 64 bit operating systems.
*Impact:* You will need to install Kibana 6.x on a 64 bit operating system. No extra data migration steps are necessary when moving from 32 bit to 64 bit.
[float]
=== NODE_ENV no longer has an impact on Kibana
*Details:* Setting the NODE_ENV environment variable can break Kibana processes in unexpected ways, which is especially unfortunate since it is a common environment variable to have configured on a system, and you wouldn't expect it to break anything in Kibana. Kibana will now effectively ignore NODE_ENV entirely.
*Impact:* If you're developing a custom plugin that depends on NODE_ENV, you will need to update it to use a different, custom environment variable.

View file

@ -74,7 +74,7 @@ module.exports = class Config {
let env = newVals.env;
delete newVals.env;
if (_.isObject(env)) env = env.name;
if (!env) env = process.env.NODE_ENV || 'production';
if (!env) env = 'production';
const dev = env === 'development';
const prod = env === 'production';