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:
authorVladimir Shushlin <v.shushlin@gmail.com>2020-11-18 12:07:40 +0300
committerVladimir Shushlin <v.shushlin@gmail.com>2020-11-18 12:07:40 +0300
commit12fa24ee96cb9d971a75df2cacfcbb1e014125e9 (patch)
treef5a4cbd161a9e6549ad5238259c655355a5454df /app.go
parent03aa0f5c194849dba64825a420192cda4efba018 (diff)
Refactor listenAndServeTLS
Diffstat (limited to 'app.go')
-rw-r--r--app.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/app.go b/app.go
index aa95a917..218c1be4 100644
--- a/app.go
+++ b/app.go
@@ -29,6 +29,7 @@ import (
"gitlab.com/gitlab-org/gitlab-pages/internal/netutil"
"gitlab.com/gitlab-org/gitlab-pages/internal/request"
"gitlab.com/gitlab-org/gitlab-pages/internal/source"
+ "gitlab.com/gitlab-org/gitlab-pages/internal/tlsconfig"
"gitlab.com/gitlab-org/gitlab-pages/metrics"
)
@@ -393,7 +394,12 @@ func (a *theApp) listenHTTPSFD(wg *sync.WaitGroup, fd uintptr, httpHandler http.
wg.Add(1)
go func() {
defer wg.Done()
- err := listenAndServeTLS(fd, a.RootCertificate, a.RootKey, httpHandler, a.ServeTLS, a.InsecureCiphers, a.TLSMinVersion, a.TLSMaxVersion, a.HTTP2, limiter)
+ tlsConfig, err := a.TLSConfig()
+ if err != nil {
+ capturingFatal(err, errortracking.WithField("listener", request.SchemeHTTPS))
+ }
+
+ err = listenAndServe(fd, httpHandler, a.HTTP2, tlsConfig, limiter)
if err != nil {
capturingFatal(err, errortracking.WithField("listener", request.SchemeHTTPS))
}
@@ -483,3 +489,8 @@ func runApp(config appConfig) {
func fatal(err error, message string) {
log.WithError(err).Fatal(message)
}
+
+func (a *theApp) TLSConfig() (*tls.Config, error) {
+ return tlsconfig.Create(a.RootCertificate, a.RootKey, a.ServeTLS,
+ a.InsecureCiphers, a.TLSMinVersion, a.TLSMaxVersion)
+}