Send gitaly token to workhorse when needed

This commit is contained in:
Jacob Vosmaer 2017-06-20 16:09:58 +02:00
parent 76bafc00e6
commit 7bda1030a5
2 changed files with 13 additions and 4 deletions

View file

@ -26,7 +26,10 @@ module Gitlab
}
if Gitlab.config.gitaly.enabled
address = Gitlab::GitalyClient.address(project.repository_storage)
server = {
address: Gitlab::GitalyClient.address(project.repository_storage),
token: Gitlab::GitalyClient.token(project.repository_storage),
}
params[:Repository] = repository.gitaly_repository.to_h
feature_enabled = case action.to_s
@ -39,8 +42,10 @@ module Gitlab
else
raise "Unsupported action: #{action}"
end
params[:GitalyAddress] = address if feature_enabled
if feature_enabled
params[:GitalyAddress] = server[:address] # This field will be deprecated
params[:GitalyServer] = server
end
end
params

View file

@ -202,7 +202,11 @@ describe Gitlab::Workhorse, lib: true do
context 'when Gitaly is enabled' do
let(:gitaly_params) do
{
GitalyAddress: Gitlab::GitalyClient.address('default')
GitalyAddress: Gitlab::GitalyClient.address('default'),
GitalyServer: {
address: Gitlab::GitalyClient.address('default'),
token: Gitlab::GitalyClient.token('default')
}
}
end