mirror of
https://github.com/caddyserver/caddy.git
synced 2025-05-31 20:24:18 -04:00
Minor style adjustments for HTTP redir logging
This commit is contained in:
parent
6c0d0511ba
commit
005c5a6382
@ -93,8 +93,8 @@ func (app *App) automaticHTTPSPhase1(ctx caddy.Context, repl *caddy.Replacer) er
|
|||||||
// https://github.com/caddyserver/caddy/issues/3443)
|
// https://github.com/caddyserver/caddy/issues/3443)
|
||||||
redirDomains := make(map[string][]caddy.NetworkAddress)
|
redirDomains := make(map[string][]caddy.NetworkAddress)
|
||||||
|
|
||||||
// the configured logger for an HTTPS enabled server
|
// the log configuration for an HTTPS enabled server
|
||||||
var logger *ServerLogConfig
|
var logCfg *ServerLogConfig
|
||||||
|
|
||||||
for srvName, srv := range app.Servers {
|
for srvName, srv := range app.Servers {
|
||||||
// as a prerequisite, provision route matchers; this is
|
// as a prerequisite, provision route matchers; this is
|
||||||
@ -176,8 +176,10 @@ func (app *App) automaticHTTPSPhase1(ctx caddy.Context, repl *caddy.Replacer) er
|
|||||||
}
|
}
|
||||||
|
|
||||||
// clone the logger so we can apply it to the HTTP server
|
// clone the logger so we can apply it to the HTTP server
|
||||||
|
// (not sure if necessary to clone it; but probably safer)
|
||||||
|
// (we choose one log cfg arbitrarily; not sure which is best)
|
||||||
if srv.Logs != nil {
|
if srv.Logs != nil {
|
||||||
logger = srv.Logs.clone()
|
logCfg = srv.Logs.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
// for all the hostnames we found, filter them so we have
|
// for all the hostnames we found, filter them so we have
|
||||||
@ -408,7 +410,7 @@ redirServersLoop:
|
|||||||
app.Servers["remaining_auto_https_redirects"] = &Server{
|
app.Servers["remaining_auto_https_redirects"] = &Server{
|
||||||
Listen: redirServerAddrsList,
|
Listen: redirServerAddrsList,
|
||||||
Routes: appendCatchAll(redirRoutes),
|
Routes: appendCatchAll(redirRoutes),
|
||||||
Logs: logger,
|
Logs: logCfg,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -664,15 +664,16 @@ func (slc ServerLogConfig) getLoggerName(host string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (slc *ServerLogConfig) clone() *ServerLogConfig {
|
func (slc *ServerLogConfig) clone() *ServerLogConfig {
|
||||||
clone := &ServerLogConfig{}
|
clone := &ServerLogConfig{
|
||||||
clone.DefaultLoggerName = slc.DefaultLoggerName
|
DefaultLoggerName: slc.DefaultLoggerName,
|
||||||
clone.LoggerNames = make(map[string]string)
|
LoggerNames: make(map[string]string),
|
||||||
|
SkipHosts: append([]string{}, slc.SkipHosts...),
|
||||||
|
SkipUnmappedHosts: slc.SkipUnmappedHosts,
|
||||||
|
ShouldLogCredentials: slc.ShouldLogCredentials,
|
||||||
|
}
|
||||||
for k, v := range slc.LoggerNames {
|
for k, v := range slc.LoggerNames {
|
||||||
clone.LoggerNames[k] = v
|
clone.LoggerNames[k] = v
|
||||||
}
|
}
|
||||||
clone.SkipHosts = append(clone.SkipHosts, slc.SkipHosts...)
|
|
||||||
clone.SkipUnmappedHosts = slc.SkipUnmappedHosts
|
|
||||||
clone.ShouldLogCredentials = slc.ShouldLogCredentials
|
|
||||||
return clone
|
return clone
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user