Created
February 2, 2012 15:20
-
-
Save emartini/1723954 to your computer and use it in GitHub Desktop.
Mount Resque server in Rails 2.3 app
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
#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