redis and sidekiq config

This commit is contained in:
Yan
2018-01-18 11:34:32 +06:30
parent 885d50f0b6
commit 721aebccdc
2 changed files with 23 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
redis = YAML::load(File.open("#{ Rails.root }/config/redis.yml"))[::Rails.env]
Sidekiq.configure_server do |config|
config.redis = { url: "#{ redis['url'] }/#{ redis['db'] }" }
end
Sidekiq.configure_client do |config|
# config.redis = { url: "redis://#{ redis['host'] }:#{ redis['port'] }/0" }
config.redis = { url: "#{ redis['url'] }/#{ redis['db'] }" }
end

13
config/redis.yml Normal file
View File

@@ -0,0 +1,13 @@
default: &default
url: redis://localhost:6379
db: 0
development:
<<: *default
test:
<<: *default
production:
<<: *default
url: redis://127.0.0.1:6379