summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKrasimir Angelov <kangelov@gitlab.com>2019-09-06 17:20:05 +1200
committerKrasimir Angelov <kangelov@gitlab.com>2019-09-10 13:56:07 +1200
commit676675dc0b95194be72dfa13829b5ba06e0d1844 (patch)
tree21a2227c9ea34b715016456ef37e2f0b4eed5df2 /lib
parent8ce331c206dd97bbfc672a554afb8bc0f8039983 (diff)
downloadgitlab-ce-676675dc0b95194be72dfa13829b5ba06e0d1844.tar.gz
Add support for custom domains to the internal Pages API
Update the `/internal/pages` endpoint to return virtual domain configuration for custom domains.
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