From 303a571f27d158b174a426c968b0e21e13fedd94 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Wed, 3 Jul 2019 17:09:50 +0100 Subject: [PATCH 1/3] chore(NA): update node options initilization on our scripts --- bin/kibana | 5 ++++- bin/kibana-plugin | 5 ++++- bin/kibana-plugin.bat | 12 +++++++++++- bin/kibana.bat | 12 +++++++++++- 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/bin/kibana b/bin/kibana index 222e7247b8492..b4c6c9dbc17b8 100755 --- a/bin/kibana +++ b/bin/kibana @@ -21,4 +21,7 @@ if [ ! -x "$NODE" ]; then exit 1 fi -NODE_ENV=production BROWSERSLIST_IGNORE_OLD_DATA=true exec "${NODE}" --no-warnings --max-http-header-size=65536 $NODE_OPTIONS "${DIR}/src/cli" ${@} +BASE_NODE_OPTIONS="--no-warnings --max-http-header-size=65536" +PARSED_NODE_OPTIONS="${NODE_OPTIONS:+" $NODE_OPTIONS"}" + +NODE_OPTIONS="${BASE_NODE_OPTIONS}${PARSED_NODE_OPTIONS}" NODE_ENV=production BROWSERSLIST_IGNORE_OLD_DATA=true exec "${NODE}" "${DIR}/src/cli" ${@} diff --git a/bin/kibana-plugin b/bin/kibana-plugin index 8b9ae268c2536..b3288b16665c7 100755 --- a/bin/kibana-plugin +++ b/bin/kibana-plugin @@ -21,4 +21,7 @@ if [ ! -x "$NODE" ]; then exit 1 fi -NODE_ENV=production exec "${NODE}" $NODE_OPTIONS --no-warnings "${DIR}/src/cli_plugin" "$@" +BASE_NODE_OPTIONS="--no-warnings" +PARSED_NODE_OPTIONS="${NODE_OPTIONS:+" $NODE_OPTIONS"}" + +NODE_OPTIONS="${BASE_NODE_OPTIONS}${PARSED_NODE_OPTIONS}" NODE_ENV=production exec "${NODE}" "${DIR}/src/cli_plugin" "$@" diff --git a/bin/kibana-plugin.bat b/bin/kibana-plugin.bat index 5a0ae70760ca1..ef61e081e81da 100755 --- a/bin/kibana-plugin.bat +++ b/bin/kibana-plugin.bat @@ -13,8 +13,18 @@ If Not Exist "%NODE%" ( Exit /B 1 ) +set "BASE_NODE_OPTIONS=--no-warnings" + +set "PARSED_NODE_OPTIONS= %NODE_OPTIONS%" + +if "%PARSED_NODE_OPTIONS: =%"=="" ( + set PARSED_NODE_OPTIONS= +) + +set "NODE_OPTIONS=%BASE_NODE_OPTIONS%%PARSED_NODE_OPTIONS%" + TITLE Kibana Server -"%NODE%" %NODE_OPTIONS% --no-warnings "%DIR%\src\cli_plugin" %* +"%NODE%" "%DIR%\src\cli_plugin" %* :finally diff --git a/bin/kibana.bat b/bin/kibana.bat index e4e6dfb4776a4..8a731d739bc51 100755 --- a/bin/kibana.bat +++ b/bin/kibana.bat @@ -14,7 +14,17 @@ If Not Exist "%NODE%" ( Exit /B 1 ) -"%NODE%" --no-warnings --max-http-header-size=65536 %NODE_OPTIONS% "%DIR%\src\cli" %* +set "BASE_NODE_OPTIONS=--no-warnings --max-http-header-size=65536" + +set "PARSED_NODE_OPTIONS= %NODE_OPTIONS%" + +if "%PARSED_NODE_OPTIONS: =%"=="" ( + set PARSED_NODE_OPTIONS= +) + +set "NODE_OPTIONS=%BASE_NODE_OPTIONS%%PARSED_NODE_OPTIONS%" + +"%NODE%" "%DIR%\src\cli" %* :finally From 2a03d6941c9b46bb778767dfa2459cf2d9eb9754 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Fri, 2 Aug 2019 01:53:09 +0100 Subject: [PATCH 2/3] chore(NA): re-export NODE_OPTIONS instead of re-setting on vars --- bin/kibana | 5 +---- bin/kibana-plugin | 5 +---- bin/kibana-plugin.bat | 13 ++----------- bin/kibana.bat | 12 +----------- src/optimize/base_optimizer.js | 6 +++++- 5 files changed, 10 insertions(+), 31 deletions(-) diff --git a/bin/kibana b/bin/kibana index 0237cc896f607..558facb9da32b 100755 --- a/bin/kibana +++ b/bin/kibana @@ -21,7 +21,4 @@ if [ ! -x "$NODE" ]; then exit 1 fi -BASE_NODE_OPTIONS="--no-warnings --max-http-header-size=65536" -PARSED_NODE_OPTIONS="${NODE_OPTIONS:+" $NODE_OPTIONS"}" - -NODE_OPTIONS="${BASE_NODE_OPTIONS}${PARSED_NODE_OPTIONS}" NODE_ENV=production exec "${NODE}" "${DIR}/src/cli" ${@} +NODE_OPTIONS="--no-warnings --max-http-header-size=65536 ${NODE_OPTIONS}" NODE_ENV=production exec "${NODE}" "${DIR}/src/cli" ${@} diff --git a/bin/kibana-plugin b/bin/kibana-plugin index b3288b16665c7..b843d4966c6d1 100755 --- a/bin/kibana-plugin +++ b/bin/kibana-plugin @@ -21,7 +21,4 @@ if [ ! -x "$NODE" ]; then exit 1 fi -BASE_NODE_OPTIONS="--no-warnings" -PARSED_NODE_OPTIONS="${NODE_OPTIONS:+" $NODE_OPTIONS"}" - -NODE_OPTIONS="${BASE_NODE_OPTIONS}${PARSED_NODE_OPTIONS}" NODE_ENV=production exec "${NODE}" "${DIR}/src/cli_plugin" "$@" +NODE_OPTIONS="--no-warnings ${NODE_OPTIONS}" NODE_ENV=production exec "${NODE}" "${DIR}/src/cli_plugin" "$@" diff --git a/bin/kibana-plugin.bat b/bin/kibana-plugin.bat index ef61e081e81da..bf382a0657ade 100755 --- a/bin/kibana-plugin.bat +++ b/bin/kibana-plugin.bat @@ -13,18 +13,9 @@ If Not Exist "%NODE%" ( Exit /B 1 ) -set "BASE_NODE_OPTIONS=--no-warnings" - -set "PARSED_NODE_OPTIONS= %NODE_OPTIONS%" - -if "%PARSED_NODE_OPTIONS: =%"=="" ( - set PARSED_NODE_OPTIONS= -) - -set "NODE_OPTIONS=%BASE_NODE_OPTIONS%%PARSED_NODE_OPTIONS%" - TITLE Kibana Server -"%NODE%" "%DIR%\src\cli_plugin" %* + +set "NODE_OPTIONS=--no-warnings %NODE_OPTIONS%" && "%NODE%" "%DIR%\src\cli_plugin" %* :finally diff --git a/bin/kibana.bat b/bin/kibana.bat index 8a731d739bc51..9d8ba359e53af 100755 --- a/bin/kibana.bat +++ b/bin/kibana.bat @@ -14,17 +14,7 @@ If Not Exist "%NODE%" ( Exit /B 1 ) -set "BASE_NODE_OPTIONS=--no-warnings --max-http-header-size=65536" - -set "PARSED_NODE_OPTIONS= %NODE_OPTIONS%" - -if "%PARSED_NODE_OPTIONS: =%"=="" ( - set PARSED_NODE_OPTIONS= -) - -set "NODE_OPTIONS=%BASE_NODE_OPTIONS%%PARSED_NODE_OPTIONS%" - -"%NODE%" "%DIR%\src\cli" %* +set "NODE_OPTIONS=--no-warnings --max-http-header-size=65536 %NODE_OPTIONS%" && "%NODE%" "%DIR%\src\cli" %* :finally diff --git a/src/optimize/base_optimizer.js b/src/optimize/base_optimizer.js index ac72363b67224..15f8bfbba1cd8 100644 --- a/src/optimize/base_optimizer.js +++ b/src/optimize/base_optimizer.js @@ -157,7 +157,11 @@ export default class BaseOptimizer { getThreadLoaderPoolConfig() { // Calculate the node options from the NODE_OPTIONS env var - const parsedNodeOptions = process.env.NODE_OPTIONS ? process.env.NODE_OPTIONS.split(/\s/) : []; + const parsedNodeOptions = process.env.NODE_OPTIONS + // thread-loader could not receive empty string as options + // or it would break + ? process.env.NODE_OPTIONS.split(/\s/).filter(opt => !!opt) + : []; return { name: 'optimizer-thread-loader-main-pool', From a9371243ccd94c67a740816b520ee0bf66b22a10 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Fri, 2 Aug 2019 14:59:35 +0100 Subject: [PATCH 3/3] chore(NA): missing doc comment --- src/optimize/base_optimizer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/optimize/base_optimizer.js b/src/optimize/base_optimizer.js index 15f8bfbba1cd8..bfeb12f0eba75 100644 --- a/src/optimize/base_optimizer.js +++ b/src/optimize/base_optimizer.js @@ -159,7 +159,7 @@ export default class BaseOptimizer { // Calculate the node options from the NODE_OPTIONS env var const parsedNodeOptions = process.env.NODE_OPTIONS // thread-loader could not receive empty string as options - // or it would break + // or it would break that's why we need to filter here ? process.env.NODE_OPTIONS.split(/\s/).filter(opt => !!opt) : [];