set RACK_ENV based on environment option
Reported by Curtis Summers | October 1st, 2008 @ 10:34 PM | in 1.1
This is a request and a preliminary patch to set the RACK_ENV environment variable based on the environment option.
I'll admit I'm not very familiar with thin's code base yet, so if there's a better place to set this than what is offered in my patch, please fix.
For the background on this issue, the following is from an email I sent to macournoyer:
I'm using the rackup option in thin's config file, and then my rack config looks like this for a Sinatra app:
require 'rubygems'
require 'sinatra'
Sinatra::Application.default_options.merge!(
:run => false, :env => ENV['RACK_ENV'] )
require 'app/application.rb'
run Sinatra.application
As suggested, I have to set the RACK_ENV variable upon startup or have it already in the environment. This is problematic for multiple configs with different environments when using the init script. I would prefer to have thin read the environment in the config and make it available to my application.
For Rack applications, would it be appropriate to have thin setup the RACK_ENV environment variable based on the environment option in thin's config file or the one passed on the command line?
Comments and changes to this ticket
-
macournoyer October 21st, 2008 @ 11:27 PM
- State changed from new to resolved
(from [1e90d63f9139f6bc5dc7624ef07076bedcbb0bb3]) Set RACK_ENV based on environment option when loading rackup file [Curtis Summers] [#83 state:resolved] http://github.com/macournoyer/th...
-
macournoyer October 21st, 2008 @ 11:30 PM
- Milestone changed from Future to 1.1
Thx for the patch Curtis!
-
macournoyer March 16th, 2009 @ 09:45 PM
(from [20a46fbc6da8bd603e1e99ee760392abdbafc067]) Merge branch 'master' into async_for_rack
- master: Set RACK_ENV based on environment option when loading rackup file [Curtis Summers] [#83 state:resolved] Add CHANGELOG entry for last merge [#85 state:resolved] Add more sites to users page Support new Rails 2.1.1 method of setting relative_url_root as well as older Rails via a respond_to? check Rails now uses ActionController::Base.relative_url_root to set relative_url_root. http://github.com/macournoyer/th...
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
People watching this ticket
Attachments
Tags
Referenced by
- 83 set RACK_ENV based on environment option (from [1e90d63f9139f6bc5dc7624ef07076bedcbb0bb3]) Set RAC...
- 83 set RACK_ENV based on environment option master: Set RACK_ENV based on environment option when loa...
- 85 [PULL] Rails 2.1 uses new method to set relative_url_root master: Set RACK_ENV based on environment option when loa...