httpcaddyfile: Sort TLS SNI matcher for deterministic JSON output (#5860)

* httpcaddyfile: Sort TLS SNI matcher, for deterministic adapt output

* Update caddyconfig/httpcaddyfile/httptype.go

---------

Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
This commit is contained in:
Francis Lavoie 2023-10-11 11:47:07 -04:00 committed by GitHub
parent 9c419f1e1a
commit 33d8d2c6b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -685,6 +685,7 @@ func (st *ServerType) serversFromPairings(
} }
if len(hosts) > 0 { if len(hosts) > 0 {
slices.Sort(hosts) // for deterministic JSON output
cp.MatchersRaw = caddy.ModuleMap{ cp.MatchersRaw = caddy.ModuleMap{
"sni": caddyconfig.JSON(hosts, warnings), // make sure to match all hosts, not just auto-HTTPS-qualified ones "sni": caddyconfig.JSON(hosts, warnings), // make sure to match all hosts, not just auto-HTTPS-qualified ones
} }