diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2019-09-11 13:21:38 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2019-09-11 13:21:38 +0000 |
commit | 68e8bbdb54f81847379659cbaad3ae9478684e24 (patch) | |
tree | 34edf07cfc6d2bbff2707d959f20226b0f00cb18 /lib | |
parent | 3c282a88aa25129c15d219351852e1ea1f2b22b6 (diff) | |
parent | 5374f423204386a4c3e6ab887214de58c0113d75 (diff) | |
download | gitlab-ce-68e8bbdb54f81847379659cbaad3ae9478684e24.tar.gz |
Merge branch '61927-pages-custom-domain-virtual-domain' into 'master'
Add support for custom domains to the Pages internal API
See merge request gitlab-org/gitlab-ce!32735
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/entities/internal.rb | 19 | ||||
-rw-r--r-- | lib/api/internal/pages.rb | 7 |
2 files changed, 25 insertions, 1 deletions
diff --git a/lib/api/entities/internal.rb b/lib/api/entities/internal.rb new file mode 100644 index 00000000000..8f79bd14833 --- /dev/null +++ b/lib/api/entities/internal.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module API + module Entities + module Internal + module Pages + class LookupPath < Grape::Entity + expose :project_id, :access_control, + :source, :https_only, :prefix + end + + class VirtualDomain < Grape::Entity + expose :certificate, :key + expose :lookup_paths, using: LookupPath + end + end + end + end +end diff --git a/lib/api/internal/pages.rb b/lib/api/internal/pages.rb index 6ea048bde03..eaa434cff51 100644 --- a/lib/api/internal/pages.rb +++ b/lib/api/internal/pages.rb @@ -18,7 +18,12 @@ module API namespace 'internal' do namespace 'pages' do get "/" do - status :ok + host = PagesDomain.find_by_domain(params[:host]) + not_found! unless host + + virtual_domain = host.pages_virtual_domain + + present virtual_domain, with: Entities::Internal::Pages::VirtualDomain end end end |