Skip to content

Instantly share code, notes, and snippets.

@assaf
Created February 1, 2010 00:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save assaf/291331 to your computer and use it in GitHub Desktop.
Save assaf/291331 to your computer and use it in GitHub Desktop.
# 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