Open jkutner opened 5 years ago
The ps:exec command does not load config variables, but does run .profile.d scripts. This results in incorrect values being set for RAILS_ENV and RACK_ENV.
ps:exec
.profile.d
RAILS_ENV
RACK_ENV
For example, if you inspect an app's .profile.d/ruby.sh, you'll see:
.profile.d/ruby.sh
~ $ cat .profile.d/ruby.sh | grep _ENV export RAILS_ENV=${RAILS_ENV:-production} export RACK_ENV=${RACK_ENV:-production}
Because your custom set RAILS_ENV config var is not load, the profile.d script sets the default value of production.
profile.d
production
The .profile.d/ruby.sh should wrap the export lines in an if guard like:
export
if
if [[ -z "$SSH_CLIENT" ]]; then export RAILS_ENV=${RAILS_ENV:-production} export RACK_ENV=${RACK_ENV:-production} fi
Wouldn't all default config vars fall into the same trap here?
@schneems yes
Related support ticket: https://heroku.support/708919
The
ps:exec
command does not load config variables, but does run.profile.d
scripts. This results in incorrect values being set forRAILS_ENV
andRACK_ENV
.For example, if you inspect an app's
.profile.d/ruby.sh
, you'll see:Because your custom set
RAILS_ENV
config var is not load, theprofile.d
script sets the default value ofproduction
.Correct behavior
The
.profile.d/ruby.sh
should wrap theexport
lines in anif
guard like: