mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: allow use of redis sentinel via redis_sentinels
Use: DISCOURSE_REDIS_SENTINELS and DISCOURSE_REDIS_HOST to configure redis sentinel
This commit is contained in:
@@ -31,6 +31,25 @@ class GlobalSetting
|
||||
{"production" => hash}
|
||||
end
|
||||
|
||||
def self.redis_config
|
||||
@config ||=
|
||||
begin
|
||||
c = {}
|
||||
c[:host] = redis_host if redis_host
|
||||
c[:port] = redis_port if redis_port
|
||||
c[:password] = redis_host if redis_password.present?
|
||||
c[:db] = redis_db if redis_db != 0
|
||||
c[:db] = 1 if Rails.env == "test"
|
||||
if redis_sentinels.present?
|
||||
c[:sentinels] = redis_sentinels.split(",").map do |address|
|
||||
host,port = address.split(":")
|
||||
{host: host, port: port}
|
||||
end.to_a
|
||||
end
|
||||
c.freeze
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
class BaseProvider
|
||||
def self.coerce(setting)
|
||||
|
||||
Reference in New Issue
Block a user