@marcel91200 / caddy Mirror · read-only / commits / da7d8cb2
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 12, 19:30 UTC

httpcaddyfile: Sort skip_hosts for deterministic JSON (#5990)

* httpcaddyfile: Sort skip_hosts for deterministic JSON * Update caddyconfig/httpcaddyfile/httptype.go Co-authored-by: Mohammed Al Sahaf <msaa1990@gmail.com> * Fix test * Bah --------- Co-authored-by: Mohammed Al Sahaf <msaa1990@gmail.com>

Francis Lavoie committed Dec 18, 2023 at 14:54 UTC da7d8cb26d97d8b797732cc0dcb697edffb693cd
2 files changed +7 -2
caddyconfig/httpcaddyfile/httptype.go
+5
@@ -820,6 +820,11 @@ func (st *ServerType) serversFromPairings(
820 }
821 }
822
823 + // sort for deterministic JSON output
824 + if srv.Logs != nil {
825 + slices.Sort(srv.Logs.SkipHosts)
826 + }
827 +
828 // a server cannot (natively) serve both HTTP and HTTPS at the
829 // same time, so make sure the configuration isn't in conflict
830 err := detectConflictingSchemes(srv, p.serverBlocks, options)
caddytest/integration/caddyfile_adapt/log_skip_hosts.txt
+2 -2
@@ -66,9 +66,9 @@ example.com {
66 "one.example.com": ""
67 },
68 "skip_hosts": [
69 + "example.com",
70 "three.example.com",
70 - "two.example.com",
71 - "example.com"
71 + "two.example.com"
72 ]
73 }
74 }