Skip to content

Commit 00e3013

Browse files
committed
Merge pull request gitlabhq#174 from UniIsland/redis-custom-database
support using custom redis database, fixes #173
2 parents 24dda4a + 4228aac commit 00e3013

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

config.yml.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ redis:
3131
port: 6379
3232
# pass: redispass # Allows you to specify the password for Redis
3333
# socket: /tmp/redis.socket # Only define this if you want to use sockets
34+
database: 0
3435
namespace: resque:gitlab
3536

3637
# Log file.

lib/gitlab_config.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,14 @@ def redis_command
5454
# for users that haven't updated their configuration
5555
%W(env -i redis-cli)
5656
else
57+
redis['database'] ||= 0
5758
if redis.has_key?("socket")
58-
%W(#{redis['bin']} -s #{redis['socket']})
59+
%W(#{redis['bin']} -s #{redis['socket']} -n #{redis['database']})
5960
else
6061
if redis.has_key?("pass")
61-
%W(#{redis['bin']} -h #{redis['host']} -p #{redis['port']} -a #{redis['pass']})
62+
%W(#{redis['bin']} -h #{redis['host']} -p #{redis['port']} -n #{redis['database']} -a #{redis['pass']})
6263
else
63-
%W(#{redis['bin']} -h #{redis['host']} -p #{redis['port']})
64+
%W(#{redis['bin']} -h #{redis['host']} -p #{redis['port']} -n #{redis['database']})
6465
end
6566
end
6667
end

spec/gitlab_config_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
it { should have_key('bin') }
1212
it { should have_key('host') }
1313
it { should have_key('port') }
14+
it { should have_key('database') }
1415
it { should have_key('namespace') }
1516
end
1617

0 commit comments

Comments
 (0)