From 676675dc0b95194be72dfa13829b5ba06e0d1844 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Fri, 6 Sep 2019 17:20:05 +1200 Subject: Add support for custom domains to the internal Pages API Update the `/internal/pages` endpoint to return virtual domain configuration for custom domains. --- app/models/pages/lookup_path.rb | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 app/models/pages/lookup_path.rb (limited to 'app/models/pages/lookup_path.rb') diff --git a/app/models/pages/lookup_path.rb b/app/models/pages/lookup_path.rb new file mode 100644 index 00000000000..1b3183a2a43 --- /dev/null +++ b/app/models/pages/lookup_path.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +module Pages + class LookupPath + def initialize(project, domain: nil) + @project = project + @domain = domain + end + + def project_id + project.id + end + + def access_control + project.private_pages? + end + + def https_only + domain_https = domain ? domain.https? : true + project.pages_https_only? && domain_https + end + + def source + { + type: 'file', + path: File.join(project.full_path, 'public/') + } + end + + def prefix + '/' + end + + private + + attr_reader :project, :domain + end +end -- cgit v1.2.1