Created
December 8, 2008 23:45
-
-
Save moonpolysoft/33686 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ScriptNameFix | |
def call(app) | |
class << app | |
def new_call(env) | |
env["SCRIPT_NAME"] = "" | |
original_call(env) | |
end | |
alias_method :original_call, :call | |
alias_method :call, :new_call | |
end | |
app | |
end | |
end | |
def get_options | |
ObjectSpace.each_object(Thin::Runner) {|runner| return runner.options} | |
end | |
options = get_options | |
puts options.inspect | |
rails_app = Rack::Adapter::Rails.new(options) | |
require "#{RAILS_ROOT}/lib/query_handler.rb" | |
run ScriptNameFix.new | |
map "/" do | |
use Rack::Lint | |
run rails_app | |
end | |
map "/query" do | |
use Rack::Lint | |
run QueryHandler.new | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment