diff --git a/lib/sidekiq/web.rb b/lib/sidekiq/web.rb index 46c4f7b1..b4cc5394 100644 --- a/lib/sidekiq/web.rb +++ b/lib/sidekiq/web.rb @@ -38,6 +38,14 @@ module Sidekiq self end + def middlewares + @middlewares ||= [] + end + + def use(*middleware_args, &block) + middlewares << [middleware_args, block] + end + def default_tabs DEFAULT_TABS end @@ -85,6 +93,8 @@ module Sidekiq use ::Rack::Session::Cookie, secret: secret use ::Rack::Protection, use: :authenticity_token unless ENV['RACK_ENV'] == 'test' + Web.middlewares.each {|middleware, block| use *middleware, &block } + run WebApplication.new(klass) end end