docbrown/config/initializers/sidekiq.rb
Molly Struve 33d6dca565
Apply Monkey Patch To Attempt To Fix Sidekiq Admin UI (#5634) [deploy]
* set sidekiq session to be the same as Rails to prevent forbidden UI errors

* monkey patch rack until new version is released to make Sidekiq Admin work
2020-01-22 14:46:24 -05:00

27 lines
781 B
Ruby

# Monkey patch `stringify_keys` to make rack 2.1.1 compatible with Sidekiq UI Admin panel.
# Should be removed when 2.1.2 is released.
# https://github.com/rack/rack/pull/1428
module Rack
module Session
module Abstract
class SessionHash
private
def stringify_keys(other)
other.to_hash.transform_keys(&:to_s)
end
end
end
end
end
Sidekiq.configure_server do |config|
sidekiq_url = ApplicationConfig["REDIS_SIDEKIQ_URL"] || ApplicationConfig["REDIS_URL"]
# On Heroku this configuration is overridden and Sidekiq will point at the redis
# instance given by the ENV variable REDIS_PROVIDER
config.redis = { url: sidekiq_url }
config.server_middleware do |chain|
chain.add Sidekiq::HoneycombMiddleware
end
end