feat(caddy): order local machine upstreams first in generated Caddyfile

This commit is contained in:
Pasha Sviderski
2026-04-23 19:42:33 +10:00
parent 9ce624facd
commit 45cf87a0cb
2 changed files with 41 additions and 7 deletions
@@ -159,6 +159,25 @@ https://secure.example.com {
}
log
}
`,
},
{
name: "local machine upstreams listed first",
containers: []store.ContainerRecord{
newContainerRecord(newContainer("10.210.0.2", "app.example.com:8080/http"), "mach1"),
newContainerRecord(newContainer("10.210.1.2", "app.example.com:8080/http"), "test-machine-id"),
newContainerRecord(newContainer("10.210.2.2", "app.example.com:8080/http"), "mach2"),
newContainerRecord(newContainer("10.210.1.3", "app.example.com:8080/http"), "test-machine-id"),
},
want: testCaddyfileHeader + `
# Sites generated from service ports.
http://app.example.com {
reverse_proxy 10.210.1.2:8080 10.210.1.3:8080 10.210.0.2:8080 10.210.2.2:8080 {
import common_proxy
}
log
}
`,
},
{