1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Add Sidekiq::Web.use

This commit is contained in:
Amadeus Folego 2016-07-30 11:12:08 -03:00
parent 34664e9215
commit 288db953e4

View file

@ -38,6 +38,14 @@ module Sidekiq
self self
end end
def middlewares
@middlewares ||= []
end
def use(*middleware_args, &block)
middlewares << [middleware_args, block]
end
def default_tabs def default_tabs
DEFAULT_TABS DEFAULT_TABS
end end
@ -85,6 +93,8 @@ module Sidekiq
use ::Rack::Session::Cookie, secret: secret use ::Rack::Session::Cookie, secret: secret
use ::Rack::Protection, use: :authenticity_token unless ENV['RACK_ENV'] == 'test' use ::Rack::Protection, use: :authenticity_token unless ENV['RACK_ENV'] == 'test'
Web.middlewares.each {|middleware, block| use *middleware, &block }
run WebApplication.new(klass) run WebApplication.new(klass)
end end
end end