Created
February 1, 2010 00:08
-
-
Save assaf/291331 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
# Rails 2.3 metal file to incorporate Resque Web UI inside Rails application. | |
# Uses HTTP Basic Authentication, until I can figure out how to get Authlogic | |
# working here. Accepts only users listed in ADMINS. | |
require "resque/server" | |
# since Authlogic is not keeping up, see http://github.com/binarylogic/authlogic/issuesearch?state=open&q=sinatra#issue/80 | |
class Sinatra::Request | |
def self.before | |
end | |
end | |
class ResqueWeb | |
@app = Rack::Builder.new { | |
map "http://admin.#{DOMAIN}/resque" do | |
use Rack::Auth::Basic, "Resque" do |email, password| | |
user = Person.find_by_email(email) | |
user && user.valid_password?(password) && ADMINS.include?(user.uid) | |
end | |
run Resque::Server.new | |
end | |
}.to_app | |
def self.call(env) | |
@app.call(env) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment