Commit 7bda1030 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Send gitaly token to workhorse when needed

parent 76bafc00
...@@ -26,7 +26,10 @@ module Gitlab ...@@ -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 ...@@ -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 ...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment