diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2020-02-24 15:52:07 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2020-02-24 15:52:38 +0300 |
commit | bfbfb6259e7c875f053b49aaf430a1c4db7a1e9f (patch) | |
tree | 55953b3e6570f413f3c25db830a4f4ce043fff5a /internal/source | |
parent | 697818eb287e1ba4e0010e0074d132896629ba64 (diff) |
Improve code quality and add a few missing comments
Diffstat (limited to 'internal/source')
-rw-r--r-- | internal/source/domains.go | 9 | ||||
-rw-r--r-- | internal/source/gitlab/gitlab.go | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/internal/source/domains.go b/internal/source/domains.go index b70b59e6..c3c4b5fe 100644 --- a/internal/source/domains.go +++ b/internal/source/domains.go @@ -82,6 +82,9 @@ func (d *Domains) source(domain string) Source { return d.disk } + // 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. if IsServerlessDomain(domain) { return d.gitlab } @@ -108,7 +111,11 @@ func (d *Domains) source(domain string) Source { } // IsServerlessDomain checks if a domain requested is a serverless domain we -// need to handle differently +// need to handle differently. +// +// Domain is a serverless domain when it matches `serverlessDomainRegex`. The +// regular expression is also defined on the gitlab-rails side, see +// https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/serverless/domain.rb#L7 func IsServerlessDomain(domain string) bool { return serverlessDomainRegex.MatchString(domain) } diff --git a/internal/source/gitlab/gitlab.go b/internal/source/gitlab/gitlab.go index 299c5acb..7accac0c 100644 --- a/internal/source/gitlab/gitlab.go +++ b/internal/source/gitlab/gitlab.go @@ -89,6 +89,8 @@ func (g *Gitlab) Resolve(r *http.Request) (*serving.Request, error) { } } + // TODO improve code around default serving, when `disk` serving gets removed + // https://gitlab.com/gitlab-org/gitlab-pages/issues/353 return &serving.Request{Serving: factory.DefaultServing()}, errors.New("could not match lookup path") } |