diff options
author | feistel <6742251-feistel@users.noreply.gitlab.com> | 2021-08-26 04:06:41 +0300 |
---|---|---|
committer | feistel <6742251-feistel@users.noreply.gitlab.com> | 2021-08-26 04:14:15 +0300 |
commit | 468c824b461678a1144d811680f6d4a30dd66130 (patch) | |
tree | cc01d6bbe277a3539f61ed82d6ad8aeb8dc1c1fa /app.go | |
parent | 0ef975db7aaa3595ebf56fde4a91351aa0174f11 (diff) |
refactor: remove internal/source/domains package
Diffstat (limited to 'app.go')
-rw-r--r-- | app.go | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -35,7 +35,6 @@ import ( "gitlab.com/gitlab-org/gitlab-pages/internal/rejectmethods" "gitlab.com/gitlab-org/gitlab-pages/internal/request" "gitlab.com/gitlab-org/gitlab-pages/internal/serving/disk/zip" - "gitlab.com/gitlab-org/gitlab-pages/internal/source" "gitlab.com/gitlab-org/gitlab-pages/internal/source/gitlab" "gitlab.com/gitlab-org/gitlab-pages/metrics" ) @@ -50,7 +49,7 @@ var ( type theApp struct { config *cfg.Config - domains *source.Domains + source *gitlab.Gitlab Artifact *artifact.Artifact Auth *auth.Auth Handlers *handlers.Handlers @@ -100,7 +99,7 @@ func (a *theApp) getHostAndDomain(r *http.Request) (string, *domain.Domain, erro } func (a *theApp) domain(ctx context.Context, host string) (*domain.Domain, error) { - return a.domains.GetDomain(ctx, host) + return a.source.GetDomain(ctx, host) } // checkAuthAndServeNotFound performs the auth process if domain can't be found @@ -221,7 +220,7 @@ func (a *theApp) acmeMiddleware(handler http.Handler) http.Handler { // authMiddleware handles authentication requests func (a *theApp) authMiddleware(handler http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if a.Auth.TryAuthenticate(w, r, a.domains) { + if a.Auth.TryAuthenticate(w, r, a.source) { return } @@ -493,12 +492,12 @@ func (a *theApp) listenMetricsFD(wg *sync.WaitGroup, fd uintptr) { } func runApp(config *cfg.Config) { - domains, err := source.NewDomains(&config.GitLab) + source, err := gitlab.New(&config.GitLab) if err != nil { log.WithError(err).Fatal("could not create domains config source") } - a := theApp{config: config, domains: domains} + a := theApp{config: config, source: source} err = logging.ConfigureLogging(a.config.Log.Format, a.config.Log.Verbose) if err != nil { |