f0391c2517
Using the sed script from https://gitlab.com/gitlab-org/gitlab-ce/issues/59758
23 lines
654 B
Ruby
23 lines
654 B
Ruby
# frozen_string_literal: true
|
|
|
|
module WorkhorseHelpers
|
|
extend self
|
|
|
|
def workhorse_send_data
|
|
@_workhorse_send_data ||= begin
|
|
header = response.headers[Gitlab::Workhorse::SEND_DATA_HEADER]
|
|
split_header = header.split(':')
|
|
type = split_header.shift
|
|
header = split_header.join(':')
|
|
[
|
|
type,
|
|
JSON.parse(Base64.urlsafe_decode64(header))
|
|
]
|
|
end
|
|
end
|
|
|
|
def workhorse_internal_api_request_header
|
|
jwt_token = JWT.encode({ 'iss' => 'gitlab-workhorse' }, Gitlab::Workhorse.secret, 'HS256')
|
|
{ 'HTTP_' + Gitlab::Workhorse::INTERNAL_API_REQUEST_HEADER.upcase.tr('-', '_') => jwt_token }
|
|
end
|
|
end
|