gitlab-org--gitlab-foss/app/models/pages/lookup_path.rb
Krasimir Angelov 676675dc0b Add support for custom domains to the internal Pages API
Update the `/internal/pages` endpoint to return virtual domain
configuration for custom domains.
2019-09-10 13:56:07 +12:00

38 lines
601 B
Ruby

# 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