refactor(config): render routes from zone domains

This commit is contained in:
ryan
2026-07-12 15:03:24 +08:00
parent d0536fcdd5
commit d4d9bad74d
18 changed files with 190 additions and 283 deletions
+6 -4
View File
@@ -9,8 +9,8 @@ import (
func TestRenderWAFConfigIncludesAllRouteSiteNames(t *testing.T) {
doc := Document{
Routes: []Route{
{ID: 1, SiteName: "", Domain: "Example.COM", Domains: []string{"example.com", "www.example.com"}},
{ID: 2, SiteName: "named-site", Domain: "other.example.com"},
{ID: 1, SiteName: "example.com", Domains: []string{"example.com", "www.example.com"}},
{ID: 2, SiteName: "named-site", Domains: []string{"other.example.com"}},
},
WAF: WAFDocument{
RuleGroups: []WAFRuleGroup{
@@ -293,7 +293,8 @@ func TestRenderRouteConfigPagesWithoutSPAFallbackServesRoot(t *testing.T) {
Routes: []Route{
{
ID: 1,
Domain: "speedtest.example.com",
SiteName: "speedtest.example.com",
Domains: []string{"speedtest.example.com"},
UpstreamType: "pages",
EnableHTTPS: false,
PagesDeployment: &PagesDeployment{
@@ -325,7 +326,8 @@ func TestRenderRouteConfigPagesWithSPAFallbackServesRoot(t *testing.T) {
Routes: []Route{
{
ID: 1,
Domain: "speedtest.example.com",
SiteName: "speedtest.example.com",
Domains: []string{"speedtest.example.com"},
UpstreamType: "pages",
EnableHTTPS: false,
PagesDeployment: &PagesDeployment{