Commit 00e30138 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #174 from UniIsland/redis-custom-database

support using custom redis database, fixes #173
parents 24dda4a8 4228aaca
...@@ -31,6 +31,7 @@ redis: ...@@ -31,6 +31,7 @@ redis:
port: 6379 port: 6379
# pass: redispass # Allows you to specify the password for Redis # pass: redispass # Allows you to specify the password for Redis
# socket: /tmp/redis.socket # Only define this if you want to use sockets # socket: /tmp/redis.socket # Only define this if you want to use sockets
database: 0
namespace: resque:gitlab namespace: resque:gitlab
# Log file. # Log file.
......
...@@ -54,13 +54,14 @@ class GitlabConfig ...@@ -54,13 +54,14 @@ class GitlabConfig
# for users that haven't updated their configuration # for users that haven't updated their configuration
%W(env -i redis-cli) %W(env -i redis-cli)
else else
redis['database'] ||= 0
if redis.has_key?("socket") if redis.has_key?("socket")
%W(#{redis['bin']} -s #{redis['socket']}) %W(#{redis['bin']} -s #{redis['socket']} -n #{redis['database']})
else else
if redis.has_key?("pass") if redis.has_key?("pass")
%W(#{redis['bin']} -h #{redis['host']} -p #{redis['port']} -a #{redis['pass']}) %W(#{redis['bin']} -h #{redis['host']} -p #{redis['port']} -n #{redis['database']} -a #{redis['pass']})
else else
%W(#{redis['bin']} -h #{redis['host']} -p #{redis['port']}) %W(#{redis['bin']} -h #{redis['host']} -p #{redis['port']} -n #{redis['database']})
end end
end end
end end
......
...@@ -11,6 +11,7 @@ describe GitlabConfig do ...@@ -11,6 +11,7 @@ describe GitlabConfig do
it { should have_key('bin') } it { should have_key('bin') }
it { should have_key('host') } it { should have_key('host') }
it { should have_key('port') } it { should have_key('port') }
it { should have_key('database') }
it { should have_key('namespace') } it { should have_key('namespace') }
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment