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:
authorfeistel <6742251-feistel@users.noreply.gitlab.com>2022-06-25 15:06:59 +0300
committerfeistel <6742251-feistel@users.noreply.gitlab.com>2022-06-25 15:06:59 +0300
commitb78029c60fe8138fd49aa560b9c4e26279049c5f (patch)
tree101d25367d9937a64970fa25133f37b797fc78b2 /app.go
parent947cad46a79aa89323fd10f6d9f2bc16c1f6741d (diff)
Move custom headers parsing into config loading
Diffstat (limited to 'app.go')
-rw-r--r--app.go23
1 files changed, 7 insertions, 16 deletions
diff --git a/app.go b/app.go
index c08dfb29..6e46f40c 100644
--- a/app.go
+++ b/app.go
@@ -48,13 +48,12 @@ var (
)
type theApp struct {
- config *cfg.Config
- source source.Source
- tlsConfig *cryptotls.Config
- Artifact *artifact.Artifact
- Auth *auth.Auth
- Handlers *handlers.Handlers
- CustomHeaders http.Header
+ config *cfg.Config
+ source source.Source
+ tlsConfig *cryptotls.Config
+ Artifact *artifact.Artifact
+ Auth *auth.Auth
+ Handlers *handlers.Handlers
}
func (a *theApp) GetCertificate(ch *cryptotls.ClientHelloInfo) (*cryptotls.Certificate, error) {
@@ -153,7 +152,7 @@ func (a *theApp) buildHandlerPipeline() (http.Handler, error) {
handler = health.NewMiddleware(handler, a.config.General.StatusPath)
// Custom response headers
- handler = customheaders.NewMiddleware(handler, a.CustomHeaders)
+ handler = customheaders.NewMiddleware(handler, a.config.General.CustomHeaders)
// Correlation ID injection middleware
var correlationOpts []correlation.InboundHandlerOption
@@ -369,14 +368,6 @@ func runApp(config *cfg.Config) error {
a.Handlers = handlers.New(a.Auth, a.Artifact)
- if len(config.General.CustomHeaders) != 0 {
- customHeaders, err := customheaders.ParseHeaderString(config.General.CustomHeaders)
- if err != nil {
- return fmt.Errorf("unable to parse header string: %w", err)
- }
- a.CustomHeaders = customHeaders
- }
-
if err := mimedb.LoadTypes(); err != nil {
log.WithError(err).Warn("Loading extended MIME database failed")
}