Commit aef26985 authored by Hunter Loftis's avatar Hunter Loftis

Merge pull request #252 from heroku/node-env-prod

default to NODE_ENV=production for build and runtime
parents aeac9d6e 459ebb67
......@@ -2,6 +2,7 @@
- Fix runtime signature cache invalidation
- Provide error messaging for un-downloadable binaries
- Default to NODE_ENV=production for both build and runtime
## v77
......
......@@ -2,12 +2,19 @@ create_default_env() {
export NPM_CONFIG_PRODUCTION=${NPM_CONFIG_PRODUCTION:-true}
export NPM_CONFIG_LOGLEVEL=${NPM_CONFIG_LOGLEVEL:-error}
export NODE_MODULES_CACHE=${NODE_MODULES_CACHE:-true}
export NODE_ENV=${NODE_ENV:-production}
}
list_node_config() {
echo ""
printenv | grep ^NPM_CONFIG_ || 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() {
......
......@@ -10,11 +10,6 @@ calculate_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() {
local default=$1
local limit=$(ulimit -u)
......@@ -29,9 +24,9 @@ detect_memory() {
export PATH="$HOME/.heroku/node/bin:$HOME/bin:$HOME/node_modules/.bin:$PATH"
export NODE_HOME="$HOME/.heroku/node"
export NODE_ENV=${NODE_ENV:-production}
calculate_concurrency
log_concurrency
export MEMORY_AVAILABLE=$MEMORY_AVAILABLE
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