diff options
Diffstat (limited to 'app.go')
-rw-r--r-- | app.go | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -2,7 +2,6 @@ package main import ( "crypto/tls" - "log" "net" "net/http" "strconv" @@ -10,9 +9,11 @@ import ( "sync" "time" + mimedb "github.com/lupine/go-mimedb" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/rs/cors" + log "github.com/sirupsen/logrus" "gitlab.com/gitlab-org/gitlab-pages/internal/artifact" "gitlab.com/gitlab-org/gitlab-pages/internal/httperrors" @@ -172,7 +173,7 @@ func (a *theApp) Run() { defer wg.Done() err := listenAndServe(fd, a.ServeHTTP, a.HTTP2, nil) if err != nil { - log.Fatal(err) + fatal(err) } }(fd) } @@ -184,7 +185,7 @@ func (a *theApp) Run() { defer wg.Done() err := listenAndServeTLS(fd, a.RootCertificate, a.RootKey, a.ServeHTTP, a.ServeTLS, a.HTTP2) if err != nil { - log.Fatal(err) + fatal(err) } }(fd) } @@ -196,7 +197,7 @@ func (a *theApp) Run() { defer wg.Done() err := listenAndServe(fd, a.ServeProxy, a.HTTP2, nil) if err != nil { - log.Fatal(err) + fatal(err) } }(fd) } @@ -210,7 +211,7 @@ func (a *theApp) Run() { handler := promhttp.HandlerFor(prometheus.DefaultGatherer, promhttp.HandlerOpts{}).ServeHTTP err := listenAndServe(fd, handler, false, nil) if err != nil { - log.Fatal(err) + fatal(err) } }(a.ListenMetrics) } @@ -226,5 +227,12 @@ func runApp(config appConfig) { if config.ArtifactsServer != "" { a.Artifact = artifact.New(config.ArtifactsServer, config.ArtifactsServerTimeout, config.Domain) } + + configureLogging(config.LogFormat) + + if err := mimedb.LoadTypes(); err != nil { + log.WithError(err).Warn("Loading extended MIME database failed") + } + a.Run() } |