Commit 6402880c authored by Yorick Peterse's avatar Yorick Peterse

Move LFS HTTP URL to a separate method

This adds a method to API::Internal that returns the URL to use for LFS
authentication tokens. This makes it possible for EE to redefine this
behaviour, without having to directly modify the source code.
parent 88abe1ec
...@@ -15,6 +15,12 @@ module API ...@@ -15,6 +15,12 @@ module API
status code status code
{ status: success, message: message }.merge(extra_options).compact { status: success, message: message }.merge(extra_options).compact
end end
def lfs_authentication_url(project)
# This is a separate method so that EE can alter its behaviour more
# easily.
project.http_url_to_repo
end
end end
namespace 'internal' do namespace 'internal' do
...@@ -118,7 +124,9 @@ module API ...@@ -118,7 +124,9 @@ module API
raise ActiveRecord::RecordNotFound.new("No key_id or user_id passed!") raise ActiveRecord::RecordNotFound.new("No key_id or user_id passed!")
end end
Gitlab::LfsToken.new(actor).authentication_payload(project.http_url_to_repo) Gitlab::LfsToken
.new(actor)
.authentication_payload(lfs_authentication_url(project))
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
......
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