diff options
| author | Chris <git@chr1831.com> | 2013-03-29 16:00:36 -0700 |
|---|---|---|
| committer | Chr1831 <Chris@Chr1831.com> | 2013-03-29 16:01:56 -0700 |
| commit | 93bfff7b3fc30fc362b90c4d362528f6e49786e6 (patch) | |
| tree | 99b609db9b0efbdc1e5919bf304fce8d003aae47 | |
| parent | ff484e65afa129c3cb37c1a1d5f92f33f129fef0 (diff) | |
| download | gitlab-shell-93bfff7b3fc30fc362b90c4d362528f6e49786e6.tar.gz | |
Added remote redis support to gitlab_update.rb
| -rw-r--r-- | config.yml.example | 8 | ||||
| -rw-r--r-- | lib/gitlab_config.rb | 4 | ||||
| -rw-r--r-- | lib/gitlab_update.rb | 6 |
3 files changed, 17 insertions, 1 deletions
diff --git a/config.yml.example b/config.yml.example index 6b0dbeb..0e9a89d 100644 --- a/config.yml.example +++ b/config.yml.example @@ -14,3 +14,11 @@ repos_path: "/home/git/repositories" # File used as authorized_keys for gitlab user auth_file: "/home/git/.ssh/authorized_keys" + +# Redis settings used for pushing commit notices to gitlab +redis: + bin: /usr/bin/redis-cli + host: 127.0.0.1 + port: 6379 + namespace: resque:gitlab + diff --git a/lib/gitlab_config.rb b/lib/gitlab_config.rb index 6cfee5d..ac6cc19 100644 --- a/lib/gitlab_config.rb +++ b/lib/gitlab_config.rb @@ -22,4 +22,8 @@ class GitlabConfig def http_settings @config['http_settings'] ||= {} end + + def redis + @config['redis'] ||= {} + end end diff --git a/lib/gitlab_update.rb b/lib/gitlab_update.rb index 8282897..acb99cb 100644 --- a/lib/gitlab_update.rb +++ b/lib/gitlab_update.rb @@ -15,6 +15,8 @@ class GitlabUpdate @oldrev = ARGV[1] @newrev = ARGV[2] + + @redis = GitlabConfig.new.redis end def exec @@ -49,7 +51,9 @@ class GitlabUpdate end def update_redis - command = "env -i redis-cli rpush 'resque:gitlab:queue:post_receive' '{\"class\":\"PostReceive\",\"args\":[\"#{@repo_path}\",\"#{@oldrev}\",\"#{@newrev}\",\"#{@refname}\",\"#{@key_id}\"]}' > /dev/null 2>&1" + command = "#{@redis['bin']} -h #{@redis['host']} -p #{@redis['port']} rpush '#{@redis['namespace']}:queue:post_receive' "+ + "'{\"class\":\"PostReceive\",\"args\":[\"#{@repo_path}\",\"#{@oldrev}\",\"#{@newrev}\",\"#{@refname}\",\"#{@key_id}\"]}' > /dev/null 2>&1" + system(command) end end |
