Skip to content

Instantly share code, notes, and snippets.

@victorgiraldes
Created March 30, 2020 17:50
Show Gist options
  • Save victorgiraldes/2e6062619c8dc06955d5abbee065aa26 to your computer and use it in GitHub Desktop.
Save victorgiraldes/2e6062619c8dc06955d5abbee065aa26 to your computer and use it in GitHub Desktop.
Sidekiq.configure_server do |config|
config.redis = {
db: 1, url: ENV.fetch('REDIS_URL'), namespace: "sidekiq_eagro_#{Rails.env}", size: Sidekiq.options[:concurrency] + 2
}
config.on(:startup) do
Sidekiq.schedule = YAML.load_file(File.expand_path('../../sidekiq_scheduler.yml', __FILE__))
SidekiqScheduler::Scheduler.instance.reload_schedule!
end
end
Sidekiq.configure_client do |config|
config.redis = { db: 1, url: ENV.fetch('REDIS_URL'), namespace: "sidekiq_eagro_#{Rails.env}" }
end
Sidekiq.default_worker_options = { backtrace: true }
if Rails.env.production? || Rails.env.staging?
require 'sidekiq/web'
Sidekiq::Web.use(Rack::Auth::Basic) do |user, password|
[user, password] == [ENV.fetch('SIDEKIQ_USER'), ENV.fetch('SIDEKIQ_PASSWORD')]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment