2019-08-01 11:50:03 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
namespace = if Rails.env.staging?
|
|
|
|
'fablab_staging'
|
|
|
|
else
|
|
|
|
'fablab'
|
|
|
|
end
|
2015-05-05 03:10:25 +02:00
|
|
|
|
2019-08-01 11:50:03 +02:00
|
|
|
redis_host = ENV['REDIS_HOST'] || 'localhost'
|
2016-03-23 18:39:41 +01:00
|
|
|
redis_url = "redis://#{redis_host}:6379"
|
|
|
|
|
2015-05-05 03:10:25 +02:00
|
|
|
Sidekiq.configure_server do |config|
|
2016-03-23 18:39:41 +01:00
|
|
|
config.redis = { url: redis_url, namespace: namespace }
|
2015-05-05 03:10:25 +02:00
|
|
|
|
2016-03-23 18:39:41 +01:00
|
|
|
# load sidekiq-cron schedule config
|
2019-08-01 11:50:03 +02:00
|
|
|
schedule_file = 'config/schedule.yml'
|
2015-05-05 03:10:25 +02:00
|
|
|
|
2019-08-01 11:50:03 +02:00
|
|
|
if File.exist?(schedule_file)
|
2016-05-25 12:21:38 +02:00
|
|
|
rendered_schedule_file = ERB.new(File.read(schedule_file)).result
|
2019-08-01 11:50:03 +02:00
|
|
|
Sidekiq::Cron::Job.load_from_hash YAML.safe_load(rendered_schedule_file)
|
2016-03-23 18:39:41 +01:00
|
|
|
end
|
|
|
|
end
|
2015-05-05 03:10:25 +02:00
|
|
|
|
2016-03-23 18:39:41 +01:00
|
|
|
Sidekiq.configure_client do |config|
|
|
|
|
config.redis = { url: redis_url, namespace: namespace }
|
2015-05-05 03:10:25 +02:00
|
|
|
end
|
2019-08-01 11:50:03 +02:00
|
|
|
|
|
|
|
Sidekiq::Extensions.enable_delay!
|