diff options
author | Francis Lavoie <[email protected]> | 2024-04-16 18:26:18 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2024-04-16 22:26:18 +0000 |
commit | 70953e873a559553e97c985a13db897ab9f573ff (patch) | |
tree | cade4037d41f21a0fb16ca879f098d6d010ea010 /caddyconfig | |
parent | eafc875ea9f6238fce24b23af47a1d7162fd27a5 (diff) | |
download | caddy-70953e873a559553e97c985a13db897ab9f573ff.tar.gz caddy-70953e873a559553e97c985a13db897ab9f573ff.zip |
caddyhttp: Support multiple logger names per host (#6088)
* caddyhttp: Support multiple logger names per host
* Lint
* Add adapt test
* Implement "string or array" parsing, keep original `logger_names`
* Rewrite adapter test to be more representative of the usecase
Diffstat (limited to 'caddyconfig')
-rw-r--r-- | caddyconfig/httpcaddyfile/httptype.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/caddyconfig/httpcaddyfile/httptype.go b/caddyconfig/httpcaddyfile/httptype.go index 99411d1cc..ab1012939 100644 --- a/caddyconfig/httpcaddyfile/httptype.go +++ b/caddyconfig/httpcaddyfile/httptype.go @@ -805,22 +805,22 @@ func (st *ServerType) serversFromPairings( // if the logger overrides the hostnames, map that to the logger name for _, h := range ncl.hostnames { if srv.Logs.LoggerNames == nil { - srv.Logs.LoggerNames = make(map[string]string) + srv.Logs.LoggerNames = make(map[string]caddyhttp.StringArray) } - srv.Logs.LoggerNames[h] = ncl.name + srv.Logs.LoggerNames[h] = append(srv.Logs.LoggerNames[h], ncl.name) } } else { // otherwise, map each host to the logger name for _, h := range sblockLogHosts { - if srv.Logs.LoggerNames == nil { - srv.Logs.LoggerNames = make(map[string]string) - } // strip the port from the host, if any host, _, err := net.SplitHostPort(h) if err != nil { host = h } - srv.Logs.LoggerNames[host] = ncl.name + if srv.Logs.LoggerNames == nil { + srv.Logs.LoggerNames = make(map[string]caddyhttp.StringArray) + } + srv.Logs.LoggerNames[host] = append(srv.Logs.LoggerNames[host], ncl.name) } } } |