From: Eric Wong <normalperson@yhbt.net>
To: unicorn list <mongrel-unicorn@rubyforge.org>
Subject: Re: [PATCH] set RACK_ENV on startup
Date: Tue, 3 Nov 2009 21:29:08 -0800 [thread overview]
Message-ID: <20091104052908.GA10096@dcvr.yhbt.net> (raw)
In-Reply-To: <C7A9411D-CD40-4DA4-9CB3-6AA959D2D127@larsen.st>
Wayne Larsen <wayne@larsen.st> wrote:
> On 2009-11-03, at 9:06 PM, Eric Wong wrote:
>> Wayne Larsen <wayne@larsen.st> 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 <wayne@larsen.st>
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: <C7A9411D-CD40-4DA4-9CB3-6AA959D2D127@larsen.st>
Acked-by: Eric Wong <normalperson@yhbt.net>
[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
next prev parent reply other threads:[~2009-11-04 5:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-04 1:24 [PATCH] set RACK_ENV on startup Wayne Larsen
2009-11-04 3:06 ` Eric Wong
2009-11-04 3:51 ` Wayne Larsen
2009-11-04 5:29 ` Eric Wong [this message]
2009-11-04 17:13 ` Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://yhbt.net/unicorn/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091104052908.GA10096@dcvr.yhbt.net \
--to=normalperson@yhbt.net \
--cc=mongrel-unicorn@rubyforge.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhbt.net/unicorn.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).