From ae2afbcc7dbac0af3256aa8b46afebf6e309bac0 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 4 Nov 2009 17:09:26 +0000 Subject: bin/unicorn: allow RACK_ENV to be passed from parent This makes our RACK_ENV handling like our RAILS_ENV handling for unicorn_rails, removing the redundant local variable. --- bin/unicorn | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/bin/unicorn b/bin/unicorn index 1916098..225e819 100755 --- a/bin/unicorn +++ b/bin/unicorn @@ -3,7 +3,7 @@ require 'unicorn/launcher' require 'optparse' -env = "development" +ENV["RACK_ENV"] ||= "development" daemonize = false listeners = [] options = { :listeners => listeners } @@ -58,7 +58,7 @@ opts = OptionParser.new("", 24, ' ') do |opts| opts.on("-E", "--env ENVIRONMENT", "use ENVIRONMENT for defaults (default: development)") do |e| - env = e + ENV["RACK_ENV"] = e end opts.on("-D", "--daemonize", "run daemonized in the background") do |d| @@ -118,8 +118,6 @@ if config =~ /\.ru$/ end end -ENV['RACK_ENV'] = env - require 'pp' if $DEBUG app = lambda do || @@ -135,7 +133,7 @@ app = lambda do || Object.const_get(File.basename(config, '.rb').capitalize) end pp({ :inner_app => inner_app }) if $DEBUG - case env + case ENV["RACK_ENV"] when "development" Rack::Builder.new do use Rack::CommonLogger, $stderr -- cgit v1.2.3-24-ge0c7