Skip to content

Instantly share code, notes, and snippets.

@emartini
Created February 2, 2012 15:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emartini/1723954 to your computer and use it in GitHub Desktop.
Save emartini/1723954 to your computer and use it in GitHub Desktop.
Mount Resque server in Rails 2.3 app
#Autor: emartini
require ::File.expand_path('../config/environment', __FILE__)
require "resque/server"
app_name = Rack::Builder.new do
use Rails::Rack::LogTailer
use Rails::Rack::Static
run ActionController::Dispatcher.new
end
# replace this for your own authentication logic:
Resque::Server.class_eval do
use Rack::Auth::Basic do |user, password|
begin
if user == "User" and password == "Password"
true
else
false
end
end
end
end
run Rack::URLMap.new \
"/" => app_name,
"/admin/resque" => Resque::Server.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment