Skip to content

Commit 0a24df3

Browse files
committed
Sentinel connection parameters in config.yml file
1 parent 4f8e91f commit 0a24df3

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

config.yml.example

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,16 @@ redis:
3838
# port: 6379
3939
# pass: redispass # Allows you to specify the password for Redis
4040
database: 0
41-
socket: /var/run/redis/redis.sock # Comment out this line if you want to use TCP
41+
socket: /var/run/redis/redis.sock # Comment out this line if you want to use TCP or Sentinel
4242
namespace: resque:gitlab
43+
# sentinels:
44+
# -
45+
# host: 127.0.0.1
46+
# port: 26380
47+
# -
48+
# host: 127.0.0.1
49+
# port: 26381
50+
4351

4452
# Log file.
4553
# Default is gitlab-shell.log in the root directory.

lib/gitlab_net.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ def redis_client
8181
db: database
8282
}
8383

84+
if redis_config.has_key?('sentinels')
85+
params[:sentinels] = redis_config['sentinels']
86+
.select { |s| s['host'] && s['port'] }
87+
.map { |s| { host: s['host'], port: s['port'] } }
88+
end
89+
8490
if redis_config.has_key?("socket")
8591
params = { path: redis_config['socket'], db: database }
8692
elsif redis_config.has_key?("pass")

0 commit comments

Comments
 (0)