ENV['REDIS_HOST'] = redis_url.host
ENV['REDIS_PORT'] = redis_url.port.to_s
ENV['REDIS_PASSWORD'] = redis_url.password
+ db_num = redis_url.path[1..-1]
+ ENV['REDIS_DB'] = db_num if db_num.present?
end
# Use a different cache store in production.
host: ENV.fetch('REDIS_HOST') { 'localhost' },
port: ENV.fetch('REDIS_PORT') { 6379 },
password: ENV.fetch('REDIS_PASSWORD') { false },
- db: 0,
+ db: ENV.fetch('REDIS_DB') { 0 },
namespace: 'cache',
expires_in: 10.minutes,
}
host = ENV.fetch('REDIS_HOST') { 'localhost' }
port = ENV.fetch('REDIS_PORT') { 6379 }
password = ENV.fetch('REDIS_PASSWORD') { false }
+db = ENV.fetch('REDIS_DB') { 0 }
Sidekiq.configure_server do |config|
- config.redis = { host: host, port: port, password: password}
+ config.redis = { host: host, port: port, db: db, password: password }
end
Sidekiq.configure_client do |config|
- config.redis = { host: host, port: port, password: password }
+ config.redis = { host: host, port: port, db: db, password: password }
end