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

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2019-09-27 13:03:29 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2019-09-27 13:04:13 +0300
commit06aeccc03e3626c10c6a0c87e917d21125d6e8a8 (patch)
treea5adecbf2fbca3f9eb4458dad12ba44d934bfa2a /internal/domain/domain.go
parentf025a4ffe992051054a64d91c28408ff6916f4f4 (diff)
Remove the concept of a custom domain from domain package
Diffstat (limited to 'internal/domain/domain.go')
-rw-r--r--internal/domain/domain.go22
1 files changed, 4 insertions, 18 deletions
diff --git a/internal/domain/domain.go b/internal/domain/domain.go
index 321c0cd9..d57687a9 100644
--- a/internal/domain/domain.go
+++ b/internal/domain/domain.go
@@ -16,7 +16,6 @@ type Domain struct {
Location string
CertificateCert string
CertificateKey string
- Customized bool // TODO we should get rid of this
Resolver Resolver
@@ -33,14 +32,6 @@ func (d *Domain) String() string {
return d.Name
}
-func (d *Domain) isCustomDomain() bool {
- if d.isUnconfigured() {
- panic("project config and group config should not be nil at the same time")
- }
-
- return d.Customized
-}
-
func (d *Domain) isUnconfigured() bool {
if d == nil {
return true
@@ -62,6 +53,7 @@ func (d *Domain) resolve(r *http.Request) (*Project, string) {
return project, subpath
}
+// GetProject returns a project details based on the request
func (d *Domain) GetProject(r *http.Request) *Project {
project, _ := d.resolve(r)
@@ -117,7 +109,8 @@ func (d *Domain) IsAccessControlEnabled(r *http.Request) bool {
// HasAcmeChallenge checks domain directory contains particular acme challenge
func (d *Domain) HasAcmeChallenge(r *http.Request, token string) bool {
- if d.isUnconfigured() || !d.isCustomDomain() || !d.HasProject(r) {
+ // TODO is that safe to redirect to acme challenge in GitLab if it is a grup domain/
+ if d.isUnconfigured() || !d.HasProject(r) {
return false
}
@@ -130,12 +123,6 @@ func (d *Domain) IsNamespaceProject(r *http.Request) bool {
return false
}
- // If request is to a custom domain, we do not handle it as a namespace project
- // as there can't be multiple projects under the same custom domain
- if d.isCustomDomain() { // TODO do we need a separate path for this
- return false
- }
-
if project := d.GetProject(r); project != nil {
return project.IsNamespaceProject
}
@@ -167,8 +154,7 @@ func (d *Domain) HasProject(r *http.Request) bool {
// EnsureCertificate parses the PEM-encoded certificate for the domain
func (d *Domain) EnsureCertificate() (*tls.Certificate, error) {
- // TODO check len certificates instead of custom domain!
- if d.isUnconfigured() || !d.isCustomDomain() {
+ if d.isUnconfigured() || len(d.CertificateKey) == 0 || len(d.CertificateCert) == 0 {
return nil, errors.New("tls certificates can be loaded only for pages with configuration")
}