summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTao <tao@huangtao.me>2014-08-24 16:51:10 +0800
committerTao <tao@huangtao.me>2014-09-13 00:07:28 +0800
commit4228aacaa77fdfb7a2be5c6198fb1e9a21d386e7 (patch)
tree6060deff857e906d815340a4dcd5f214f5bea1cf
parent24dda4a8b4355859a2451d9e67e3eaff6ff6e443 (diff)
downloadgitlab-shell-4228aacaa77fdfb7a2be5c6198fb1e9a21d386e7.tar.gz
support using custom redis database, fixes #173
-rw-r--r--config.yml.example1
-rw-r--r--lib/gitlab_config.rb7
-rw-r--r--spec/gitlab_config_spec.rb1
3 files changed, 6 insertions, 3 deletions
diff --git a/config.yml.example b/config.yml.example
index 972b539..c9c5b41 100644
--- a/config.yml.example
+++ b/config.yml.example
@@ -31,6 +31,7 @@ redis:
port: 6379
# pass: redispass # Allows you to specify the password for Redis
# socket: /tmp/redis.socket # Only define this if you want to use sockets
+ database: 0
namespace: resque:gitlab
# Log file.
diff --git a/lib/gitlab_config.rb b/lib/gitlab_config.rb
index 1ebb08e..ccd17ed 100644
--- a/lib/gitlab_config.rb
+++ b/lib/gitlab_config.rb
@@ -54,13 +54,14 @@ class GitlabConfig
# for users that haven't updated their configuration
%W(env -i redis-cli)
else
+ redis['database'] ||= 0
if redis.has_key?("socket")
- %W(#{redis['bin']} -s #{redis['socket']})
+ %W(#{redis['bin']} -s #{redis['socket']} -n #{redis['database']})
else
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
- %W(#{redis['bin']} -h #{redis['host']} -p #{redis['port']})
+ %W(#{redis['bin']} -h #{redis['host']} -p #{redis['port']} -n #{redis['database']})
end
end
end
diff --git a/spec/gitlab_config_spec.rb b/spec/gitlab_config_spec.rb
index aeeac56..d2b4776 100644
--- a/spec/gitlab_config_spec.rb
+++ b/spec/gitlab_config_spec.rb
@@ -11,6 +11,7 @@ describe GitlabConfig do
it { should have_key('bin') }
it { should have_key('host') }
it { should have_key('port') }
+ it { should have_key('database') }
it { should have_key('namespace') }
end