# This file is overwritten on deploy

Sidekiq.configure_client do |config|
  config.redis = { namespace: 'signon' }
end
Sidekiq.configure_server do |config|
  config.redis = { namespace: 'signon' }
  config.server_middleware do |chain|
    chain.add Sidekiq::Middleware::Server::RetryJobs, max_retries: 5
  end
end

require "sidekiq"

redis_config = { namespace: "signon_sidekiq" }
redis_config[:url] = ENV['REDIS_URL'] if ENV['REDIS_URL']

Sidekiq.configure_server do |config|
  config.redis = redis_config
  config.server_middleware do |chain|
    chain.add Sidekiq::Statsd::ServerMiddleware, env: 'govuk.app.signon', prefix: 'workers'
  end
end

Sidekiq.configure_client do |config|
  config.redis = redis_config
end

Consolidate the Sidekiq config with production
Consolidate the Sidekiq config with production

Taking the redis URL from the environment will allow to have one common
config and not replace the initializer in 'alphagov-deployment'.
