unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Wayne Larsen <wayne@larsen.st>
To: unicorn list <mongrel-unicorn@rubyforge.org>
Subject: Re: [PATCH] set RACK_ENV on startup
Date: Tue, 3 Nov 2009 21:51:12 -0600	[thread overview]
Message-ID: <C7A9411D-CD40-4DA4-9CB3-6AA959D2D127@larsen.st> (raw)
In-Reply-To: <20091104030635.GA5282@dcvr.yhbt.net>

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

> Wayne Larsen <wayne@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:
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


> 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):
http://groups.google.com/group/rack-devel/browse_frm/thread/109241d9246f91ab/4a0d2f61a7851a6c?lnk=gst&q=RACK_ENV#4a0d2f61a7851a6c

or  http://tinyurl.com/yl9re66

And this discussion:
http://groups.google.com/group/rack-devel/browse_frm/thread/822ce0551fbefa27/d52ea85fcb4e5a51?lnk=gst&q=RACK_ENV#d52ea85fcb4e5a51
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.

Wayne

  reply	other threads:[~2009-11-04  3:59 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 [this message]
2009-11-04  5:29     ` Eric Wong
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=C7A9411D-CD40-4DA4-9CB3-6AA959D2D127@larsen.st \
    --to=wayne@larsen.st \
    --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).