[PATCH] set RACK_ENV on startup

Wayne Larsen wayne at larsen.st
Tue Nov 3 22:51:12 EST 2009

On 2009-11-03, at 9:06 PM, Eric Wong wrote:

> Wayne Larsen <wayne at larsen.st> wrote:
>> Most stupid patch ever, but is there a reason not to set RACK_ENV on
>> startup with `unicorn`, as RAILS_ENV is set with `unicorn_rails`?
> Hi Wayne,
> Does anything use/depend on it?  `unicorn' is modeled after `rackup'  
> and
> I don't think it's a good idea to expose things if nothing uses it
> (rackup does not set it, either).
Passenger passes the RACK_ENV value to apps:

As does thin:

Sinatra uses it to set its environment:

As does Merb:

> RAILS_ENV is an accepted standard for Rails applications and there are
> plenty of things that already depend on it.

It seems to me that RACK_ENV is a semi-standard. From a search of the  
rack group, this has come up before (unanswered):

or  http://tinyurl.com/yl9re66

And this discussion:
also at http://tinyurl.com/yhssua2

where some suggested that it should be available in the rack  
environment instead of as a global ENV variable.

It seems like the pragmatic answer would be to set it.


More information about the mongrel-unicorn mailing list