diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2020-02-27 18:20:05 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2020-02-27 18:20:05 +0300 |
commit | 49bc9ee2bd8acc0e194f865521ecd92f90338e70 (patch) | |
tree | 1dbb5e5ae83fc759171721a0657c15ec6786a3c4 | |
parent | c3003881c27fea2ff2ac45788997a8cefd73b9d5 (diff) |
Improve comments and code readability
-rw-r--r-- | internal/domain/domain.go | 4 | ||||
-rw-r--r-- | internal/serving/disk/serving.go | 6 | ||||
-rw-r--r-- | internal/source/domains.go | 8 |
3 files changed, 9 insertions, 9 deletions
diff --git a/internal/domain/domain.go b/internal/domain/domain.go index a1ee896e..17a0e1d3 100644 --- a/internal/domain/domain.go +++ b/internal/domain/domain.go @@ -49,8 +49,8 @@ func (d *Domain) resolve(r *http.Request) *serving.Request { return request } -// GetLookupPath returns a project details based on the request. If LookupPath -// is nil it means that a project does not exist. +// GetLookupPath returns a project details based on the request. It returns nil +// if project does not exist. func (d *Domain) GetLookupPath(r *http.Request) *serving.LookupPath { request := d.resolve(r) diff --git a/internal/serving/disk/serving.go b/internal/serving/disk/serving.go index 9182da75..aead03ea 100644 --- a/internal/serving/disk/serving.go +++ b/internal/serving/disk/serving.go @@ -5,11 +5,7 @@ import ( "gitlab.com/gitlab-org/gitlab-pages/internal/serving" ) -var disk *Disk - -func init() { - disk = &Disk{} -} +var disk *Disk = &Disk{} // Disk describes a disk access serving type Disk struct { diff --git a/internal/source/domains.go b/internal/source/domains.go index c3c4b5fe..11794b91 100644 --- a/internal/source/domains.go +++ b/internal/source/domains.go @@ -15,7 +15,11 @@ import ( ) var ( - gitlabSourceConfig gitlabsourceconfig.GitlabSourceConfig + gitlabSourceConfig gitlabsourceconfig.GitlabSourceConfig + + // serverlessDomainRegex is a regular expression we use to check if a domain + // is a serverless domain, to short circut gitlab source rollout. It can be + // removed after the rollout is done serverlessDomainRegex = regexp.MustCompile(`^[^.]+-[[:xdigit:]]{2}a1[[:xdigit:]]{10}f2[[:xdigit:]]{2}[[:xdigit:]]+-?.*`) ) @@ -84,7 +88,7 @@ func (d *Domains) source(domain string) Source { // This check is only needed until we enable `d.gitlab` source in all // environments (including on-premises installations) followed by removal of - // `d,disk` source. This can be safely removed afterwards. + // `d.disk` source. This can be safely removed afterwards. if IsServerlessDomain(domain) { return d.gitlab } |