summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJacob Vosmaer <jacob@gitlab.com>2017-03-24 18:22:42 +0100
committerJacob Vosmaer <jacob@gitlab.com>2017-03-29 14:48:05 +0200
commit1904c80f3dd5437cb39aa90de933279bf9635678 (patch)
tree6de907068aadafc992ada78ffb0b484b1ad74faa /lib
parenteee07f1c7cacdd24cbd66917ba66e703128f65c6 (diff)
downloadgitlab-ce-1904c80f3dd5437cb39aa90de933279bf9635678.tar.gz
Change socket_path to gitaly_address
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/gitaly_client.rb16
-rw-r--r--lib/gitlab/workhorse.rb9
2 files changed, 16 insertions, 9 deletions
diff --git a/lib/gitlab/gitaly_client.rb b/lib/gitlab/gitaly_client.rb
index c947075bf62..a0dbe0a8c11 100644
--- a/lib/gitlab/gitaly_client.rb
+++ b/lib/gitlab/gitaly_client.rb
@@ -4,9 +4,11 @@ module Gitlab
module GitalyClient
SERVER_VERSION_FILE = 'GITALY_SERVER_VERSION'.freeze
- def self.configure_channel(shard, socket_path)
- @channel ||= {}
- @channel[shard] = new_channel("unix://#{socket_path}")
+ def self.configure_channel(storage, address)
+ @addresses ||= {}
+ @addresses[storage] = address
+ @channels ||= {}
+ @channels[storage] = new_channel(address)
end
def self.new_channel(address)
@@ -16,8 +18,12 @@ module Gitlab
GRPC::Core::Channel.new(address, {}, :this_channel_is_insecure)
end
- def self.get_channel(shard)
- @channel.fetch(shard)
+ def self.get_channel(storage)
+ @channels[storage]
+ end
+
+ def self.get_address(storage)
+ @addresses[storage]
end
def self.enabled?
diff --git a/lib/gitlab/workhorse.rb b/lib/gitlab/workhorse.rb
index eae1a0abf06..6fe85af3c30 100644
--- a/lib/gitlab/workhorse.rb
+++ b/lib/gitlab/workhorse.rb
@@ -1,6 +1,7 @@
require 'base64'
require 'json'
require 'securerandom'
+require 'uri'
module Gitlab
class Workhorse
@@ -21,10 +22,10 @@ module Gitlab
RepoPath: repository.path_to_repo,
}
- params.merge!(
- GitalySocketPath: Gitlab.config.gitaly.socket_path,
- GitalyResourcePath: "/projects/#{repository.project.id}/git-http/info-refs",
- ) if Gitlab.config.gitaly.socket_path.present?
+ if Gitlab.config.gitaly.enabled
+ address = Gitlab::GitalyClient.get_address(repository.project.repository_storage)
+ params[:GitalySocketPath] = URI(address).path
+ end
params
end