Wayne Larsen <[email protected]> wrote: > On 2009-11-03, at 9:06 PM, Eric Wong wrote: >> Wayne Larsen <[email protected]> wrote: >> >> 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: > http://www.modrails.com/documentation/Users%20guide%20Nginx.html#RackEnv > > As does thin: > http://github.com/macournoyer/thin/blob/master/lib/thin/controllers/controller.rb#L169 > > Sinatra uses it to set its environment: > http://github.com/sinatra/sinatra/blob/master/lib/sinatra/base.rb#L1013 > > As does Merb: > http://github.com/merb/merb/blob/master/merb-gen/lib/generators/templates/application/merb_stack/config.ru
> It seems like the pragmatic answer would be to set it. Agreed. Thanks for the research and links! I've pushed out the following change: >From c7f2242a53ceec6892bd72f0df771266d5193004 Mon Sep 17 00:00:00 2001 From: Wayne Larsen <[email protected]> Date: Tue, 3 Nov 2009 21:12:47 -0800 Subject: [PATCH] bin/unicorn: set ENV["RACK_ENV"] on startup Although not currently part of the Rack specification, ENV["RACK_ENV"] is at least a de facto standard. Some of the popular Rack servers (Thin, Passenger) and frameworks (Merb, Sinatra) already set or use it. ML-Ref: <[email protected]> Acked-by: Eric Wong <[email protected]> [ew: setenv always, not just on CLI + commit message] --- bin/unicorn | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/bin/unicorn b/bin/unicorn index 0fed11e..1916098 100755 --- a/bin/unicorn +++ b/bin/unicorn @@ -118,6 +118,8 @@ if config =~ /\.ru$/ end end +ENV['RACK_ENV'] = env + require 'pp' if $DEBUG app = lambda do || -- Eric Wong _______________________________________________ mongrel-unicorn mailing list [email protected] http://rubyforge.org/mailman/listinfo/mongrel-unicorn
