Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2019-09-11 16:21:38 +0300
committerKamil Trzciński <ayufan@ayufan.eu>2019-09-11 16:21:38 +0300
commit68e8bbdb54f81847379659cbaad3ae9478684e24 (patch)
tree34edf07cfc6d2bbff2707d959f20226b0f00cb18 /lib
parent3c282a88aa25129c15d219351852e1ea1f2b22b6 (diff)
parent5374f423204386a4c3e6ab887214de58c0113d75 (diff)
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.rb19
-rw-r--r--lib/api/internal/pages.rb7
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