Reputation: 4768
I have a Rails application already in production. The guy before set these environment variables:
...
export RACK_ENV=none
export RAILS_ENV=production
...
What does RACK_ENV=none
do? I can't find documentation on it anywhere. Do I need to set it in the Rails application or can I just delete that export?
Upvotes: 10
Views: 10608
Reputation: 37617
If you're using version 1.7 or later of the database_cleaner gem, and your CI server has RACK_ENV
set to production
like mine did, you'll need to set RACK_ENV
to none
(or anything other than production
) to appease database_cleaner's safeguard that your tests aren't running in production. (Or you could disable the safeguard altogether, but that seems less safe.)
Looking at current rack source, it appears that the only value of RACK_ENV that is meaningful to rack is development
, which causes rack to default the host to localhost
instead of to 0.0.0.0
. So it's foolish to set RACK_ENV to production
in the first place, or to check that it's been set to that, but that foolishness has taken root all over.
Upvotes: 3
Reputation: 1627
IMHO it's useless.
To find the current environment a Rails app first looks for the RAILS_ENV
environment variable, then for RACK_ENV
environment variable, then it defaults to 'development'
.
Upvotes: 10