2025-03-19 12:36:16 -04:00
|
|
|
require "sidekiq/web"
|
|
|
|
|
2025-05-16 14:17:56 -04:00
|
|
|
if Rails.env.production?
|
|
|
|
Sidekiq::Web.use(Rack::Auth::Basic) do |username, password|
|
|
|
|
configured_username = ::Digest::SHA256.hexdigest(ENV.fetch("SIDEKIQ_WEB_USERNAME", "maybe"))
|
|
|
|
configured_password = ::Digest::SHA256.hexdigest(ENV.fetch("SIDEKIQ_WEB_PASSWORD", "maybe"))
|
2025-03-19 12:36:16 -04:00
|
|
|
|
2025-05-16 14:17:56 -04:00
|
|
|
ActiveSupport::SecurityUtils.secure_compare(::Digest::SHA256.hexdigest(username), configured_username) &&
|
|
|
|
ActiveSupport::SecurityUtils.secure_compare(::Digest::SHA256.hexdigest(password), configured_password)
|
|
|
|
end
|
2025-03-19 12:36:16 -04:00
|
|
|
end
|
2025-05-15 10:19:56 -04:00
|
|
|
|
|
|
|
Sidekiq::Cron.configure do |config|
|
|
|
|
# 10 min "catch-up" window in case worker process is re-deploying when cron tick occurs
|
|
|
|
config.reschedule_grace_period = 600
|
|
|
|
end
|