From c110d110a0078f3e22594a7c447aa0e727b88d78 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 19 Apr 2013 23:10:38 +0300 Subject: Fix and refactor redis command --- lib/gitlab_config.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'lib/gitlab_config.rb') diff --git a/lib/gitlab_config.rb b/lib/gitlab_config.rb index ac6cc19..ede554d 100644 --- a/lib/gitlab_config.rb +++ b/lib/gitlab_config.rb @@ -26,4 +26,23 @@ class GitlabConfig def redis @config['redis'] ||= {} end + + def redis_namespace + redis['namespace'] || 'resque:gitlab' + end + + # Build redis command to write update event in gitlab queue + def redis_command + if redis.empty? + # Default to old method of connecting to redis + # for users that haven't updated their configuration + "env -i redis-cli" + else + if redis.has_key?("socket") + "#{redis['bin']} -s #{redis['socket']}" + else + "#{redis['bin']} -h #{redis['host']} -p #{redis['port']}" + end + end + end end -- cgit v1.2.1