about summary refs log tree commit homepage
path: root/bin
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-09-30 15:02:59 -0700
committerEric Wong <normalperson@yhbt.net>2009-09-30 16:07:46 -0700
commite87d9decb82fbbde50926911167fecebd4bcc25e (patch)
tree34e4eda8f2152fc931621929596352cfae7d3a68 /bin
parente417bd2d262f703212d4d671498420e554105639 (diff)
downloadunicorn-e87d9decb82fbbde50926911167fecebd4bcc25e.tar.gz
Since Unicorn config files are written in Ruby, setting
RAILS_RELATIVE_URL_ROOT should be possible (and even encouraged)
in the config file if it is done at all.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/unicorn_rails8
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/unicorn_rails b/bin/unicorn_rails
index ab0cfa3..ab9f1c0 100755
--- a/bin/unicorn_rails
+++ b/bin/unicorn_rails
@@ -12,7 +12,6 @@ options = { :listeners => listeners }
 host, port = Unicorn::Const::DEFAULT_HOST, Unicorn::Const::DEFAULT_PORT
 set_listener = false
 ENV['RAILS_ENV'] ||= "development"
-map_path = ENV['RAILS_RELATIVE_URL_ROOT']
 
 opts = OptionParser.new("", 24, '  ') do |opts|
   opts.banner = "Usage: #{cmd} " \
@@ -81,8 +80,9 @@ opts = OptionParser.new("", 24, '  ') do |opts|
 
   opts.on("-P", "--path PATH", "DEPRECATED") do |v|
     warn %q{Use of --path/-P is strongly discouraged}
-    warn %q{Use the 'map' directive in the rackup config instead}
-    ENV['RAILS_RELATIVE_URL_ROOT'] = map_path = v
+    warn %q{Use the RAILS_RELATIVE_URL_ROOT environment variable}
+    warn %q{  or the 'map' directive in the rackup config instead}
+    ENV['RAILS_RELATIVE_URL_ROOT'] = v
   end
 
   # I'm avoiding Unicorn-specific config options on the command-line.
@@ -156,8 +156,8 @@ app = lambda do ||
     Object.const_get(File.basename(config, '.rb').capitalize)
   end
 
-  map_path ||= '/'
   Rack::Builder.new do
+    map_path = ENV['RAILS_RELATIVE_URL_ROOT'] || '/'
     if inner_app.class.to_s == "Unicorn::App::OldRails"
       if map_path != '/'
         # patches + tests welcome, but I really cbf to deal with this