Send gitaly token to workhorse when needed
This commit is contained in:
parent
76bafc00e6
commit
7bda1030a5
|
@ -26,7 +26,10 @@ module Gitlab
|
||||||
}
|
}
|
||||||
|
|
||||||
if Gitlab.config.gitaly.enabled
|
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
|
params[:Repository] = repository.gitaly_repository.to_h
|
||||||
|
|
||||||
feature_enabled = case action.to_s
|
feature_enabled = case action.to_s
|
||||||
|
@ -39,8 +42,10 @@ module Gitlab
|
||||||
else
|
else
|
||||||
raise "Unsupported action: #{action}"
|
raise "Unsupported action: #{action}"
|
||||||
end
|
end
|
||||||
|
if feature_enabled
|
||||||
params[:GitalyAddress] = address if feature_enabled
|
params[:GitalyAddress] = server[:address] # This field will be deprecated
|
||||||
|
params[:GitalyServer] = server
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
params
|
params
|
||||||
|
|
|
@ -202,7 +202,11 @@ describe Gitlab::Workhorse, lib: true do
|
||||||
context 'when Gitaly is enabled' do
|
context 'when Gitaly is enabled' do
|
||||||
let(:gitaly_params) 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
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue