Compare commits
1 commit
develop
...
test/redis
Author | SHA1 | Date | |
---|---|---|---|
|
9bdfdb06fb |
1 changed files with 4 additions and 2 deletions
|
@ -6,6 +6,8 @@ module Redis::Config
|
|||
end
|
||||
|
||||
def config
|
||||
::Kernel.binding.pry
|
||||
|
||||
@config ||= sentinel? ? sentinel_config : base_config
|
||||
end
|
||||
|
||||
|
@ -29,13 +31,13 @@ module Redis::Config
|
|||
# expected format for REDIS_SENTINELS url string is host1:port1, host2:port2
|
||||
sentinels = redis_sentinels.split(',').map do |sentinel_url|
|
||||
host, port = sentinel_url.split(':').map(&:strip)
|
||||
{ host: host, port: port.presence || DEFAULT_SENTINEL_PORT, password: base_config[:password] }
|
||||
{ host: host, port: port.presence || DEFAULT_SENTINEL_PORT }
|
||||
end
|
||||
|
||||
# over-write redis url as redis://:<your-redis-password>@<master-name>/ when using sentinel
|
||||
# more at https://github.com/redis/redis-rb/issues/531#issuecomment-263501322
|
||||
master = "redis://#{ENV.fetch('REDIS_SENTINEL_MASTER_NAME', 'mymaster')}"
|
||||
|
||||
::Kernel.binding.pry
|
||||
base_config.merge({ url: master, sentinels: sentinels })
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue