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
path: root/app.go
diff options
context:
space:
mode:
Diffstat (limited to 'app.go')
-rw-r--r--app.go18
1 files changed, 14 insertions, 4 deletions
diff --git a/app.go b/app.go
index 08eff7e7..9d4f5bdb 100644
--- a/app.go
+++ b/app.go
@@ -17,6 +17,7 @@ import (
log "github.com/sirupsen/logrus"
mimedb "gitlab.com/lupine/go-mimedb"
+ "gitlab.com/gitlab-org/gitlab-pages/internal/acme"
"gitlab.com/gitlab-org/gitlab-pages/internal/admin"
"gitlab.com/gitlab-org/gitlab-pages/internal/artifact"
"gitlab.com/gitlab-org/gitlab-pages/internal/auth"
@@ -38,10 +39,11 @@ var (
type theApp struct {
appConfig
- dm domain.Map
- lock sync.RWMutex
- Artifact *artifact.Artifact
- Auth *auth.Auth
+ dm domain.Map
+ lock sync.RWMutex
+ Artifact *artifact.Artifact
+ Auth *auth.Auth
+ AcmeMiddleware *acme.Middleware
}
func (a *theApp) isReady() bool {
@@ -166,6 +168,10 @@ func (a *theApp) serveContent(ww http.ResponseWriter, r *http.Request, https boo
host, domain := a.getHostAndDomain(r)
+ if a.AcmeMiddleware.ServeAcmeChallenges(&w, r, domain) {
+ return
+ }
+
if a.Auth.TryAuthenticate(&w, r, a.dm, &a.lock) {
return
}
@@ -360,6 +366,10 @@ func runApp(config appConfig) {
config.RedirectURI, config.GitLabServer)
}
+ if config.GitLabServer != "" {
+ a.AcmeMiddleware = &acme.Middleware{GitlabURL: config.GitLabServer}
+ }
+
configureLogging(config.LogFormat, config.LogVerbose)
if err := mimedb.LoadTypes(); err != nil {