Commit 459ebb67 authored by Hunter Loftis's avatar Hunter Loftis

default to NODE_ENV=production for build and runtime

parent aeac9d6e
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
- Fix runtime signature cache invalidation - Fix runtime signature cache invalidation
- Provide error messaging for un-downloadable binaries - Provide error messaging for un-downloadable binaries
- Default to NODE_ENV=production for both build and runtime
## v77 ## v77
......
...@@ -2,12 +2,19 @@ create_default_env() { ...@@ -2,12 +2,19 @@ create_default_env() {
export NPM_CONFIG_PRODUCTION=${NPM_CONFIG_PRODUCTION:-true} export NPM_CONFIG_PRODUCTION=${NPM_CONFIG_PRODUCTION:-true}
export NPM_CONFIG_LOGLEVEL=${NPM_CONFIG_LOGLEVEL:-error} export NPM_CONFIG_LOGLEVEL=${NPM_CONFIG_LOGLEVEL:-error}
export NODE_MODULES_CACHE=${NODE_MODULES_CACHE:-true} export NODE_MODULES_CACHE=${NODE_MODULES_CACHE:-true}
export NODE_ENV=${NODE_ENV:-production}
} }
list_node_config() { list_node_config() {
echo "" echo ""
printenv | grep ^NPM_CONFIG_ || true printenv | grep ^NPM_CONFIG_ || true
printenv | grep ^NODE_ || true printenv | grep ^NODE_ || true
if [ "$NPM_CONFIG_PRODUCTION" = "true" ] && [ "$NODE_ENV" != "production" ]; then
echo ""
echo "npm scripts will see NODE_ENV=production (not '${NODE_ENV}')"
echo "https://docs.npmjs.com/misc/config#production"
fi
} }
export_env_dir() { export_env_dir() {
......
...@@ -10,11 +10,6 @@ calculate_concurrency() { ...@@ -10,11 +10,6 @@ calculate_concurrency() {
WEB_CONCURRENCY=$WEB_CONCURRENCY WEB_CONCURRENCY=$WEB_CONCURRENCY
} }
log_concurrency() {
echo "Detected $MEMORY_AVAILABLE MB available memory, $WEB_MEMORY MB limit per process (WEB_MEMORY)"
echo "Recommending WEB_CONCURRENCY=$WEB_CONCURRENCY"
}
detect_memory() { detect_memory() {
local default=$1 local default=$1
local limit=$(ulimit -u) local limit=$(ulimit -u)
...@@ -29,9 +24,9 @@ detect_memory() { ...@@ -29,9 +24,9 @@ detect_memory() {
export PATH="$HOME/.heroku/node/bin:$HOME/bin:$HOME/node_modules/.bin:$PATH" export PATH="$HOME/.heroku/node/bin:$HOME/bin:$HOME/node_modules/.bin:$PATH"
export NODE_HOME="$HOME/.heroku/node" export NODE_HOME="$HOME/.heroku/node"
export NODE_ENV=${NODE_ENV:-production}
calculate_concurrency calculate_concurrency
log_concurrency
export MEMORY_AVAILABLE=$MEMORY_AVAILABLE export MEMORY_AVAILABLE=$MEMORY_AVAILABLE
export WEB_MEMORY=$WEB_MEMORY export WEB_MEMORY=$WEB_MEMORY
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment