diff options
author | Gabriel Mazetto <brodock@gmail.com> | 2016-08-18 12:23:48 +0200 |
---|---|---|
committer | Gabriel Mazetto <brodock@gmail.com> | 2016-08-18 12:28:07 +0200 |
commit | 0a24df3371c4af2a2b1e6a61a3048c80cd51536c (patch) | |
tree | 5cc784c280ecfda2ba1fbf36fcce46cebd78cc77 | |
parent | 4f8e91fac043f09ea94a3542eeff9734db33645a (diff) | |
download | gitlab-shell-0a24df3371c4af2a2b1e6a61a3048c80cd51536c.tar.gz |
Sentinel connection parameters in `config.yml` file
-rw-r--r-- | config.yml.example | 10 | ||||
-rw-r--r-- | lib/gitlab_net.rb | 6 |
2 files changed, 15 insertions, 1 deletions
diff --git a/config.yml.example b/config.yml.example index 166e384..cd66022 100644 --- a/config.yml.example +++ b/config.yml.example @@ -38,8 +38,16 @@ redis: # port: 6379 # pass: redispass # Allows you to specify the password for Redis database: 0 - socket: /var/run/redis/redis.sock # Comment out this line if you want to use TCP + socket: /var/run/redis/redis.sock # Comment out this line if you want to use TCP or Sentinel namespace: resque:gitlab + # sentinels: + # - + # host: 127.0.0.1 + # port: 26380 + # - + # host: 127.0.0.1 + # port: 26381 + # Log file. # Default is gitlab-shell.log in the root directory. diff --git a/lib/gitlab_net.rb b/lib/gitlab_net.rb index c06ed1e..35a8833 100644 --- a/lib/gitlab_net.rb +++ b/lib/gitlab_net.rb @@ -81,6 +81,12 @@ class GitlabNet db: database } + if redis_config.has_key?('sentinels') + params[:sentinels] = redis_config['sentinels'] + .select { |s| s['host'] && s['port'] } + .map { |s| { host: s['host'], port: s['port'] } } + end + if redis_config.has_key?("socket") params = { path: redis_config['socket'], db: database } elsif redis_config.has_key?("pass") |