Created
August 21, 2014 20:30
-
-
Save geronimod/5a98d84a320e816f797c to your computer and use it in GitHub Desktop.
Example of ResqueWeb for RoR 2.3
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 ResqueWeb | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
if env['PATH_INFO'].include? '/resque' | |
resque_web = Rack::Builder.new { | |
map "/resque" do | |
use Rack::Auth::Basic, "Resque" do |user, password| | |
user == 'xxxx' && password == 'xxxx' | |
end | |
run Resque::Server.new | |
end | |
}.to_app | |
resque_web.call env | |
else | |
@app.call env | |
end | |
end | |
end | |
Rails.configuration.middleware.use 'ResqueWeb' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment