about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-11-04 17:09:26 +0000
committerEric Wong <normalperson@yhbt.net>2009-11-04 17:09:26 +0000
commitae2afbcc7dbac0af3256aa8b46afebf6e309bac0 (patch)
treeaf2e7c79668ea720c7387f851330ccfb51ec2189
parentb2f6932ffcdab271845a7feed908fbc6db69e6b7 (diff)
downloadunicorn-ae2afbcc7dbac0af3256aa8b46afebf6e309bac0.tar.gz
This makes our RACK_ENV handling like our RAILS_ENV
handling for unicorn_rails, removing the redundant
local variable.
-rwxr-xr-xbin/unicorn8
1 files 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