From 642e6ebdc8a2e5913041183644e1462cac46be3e Mon Sep 17 00:00:00 2001 From: yusing Date: Thu, 9 Jan 2025 04:44:55 +0800 Subject: [PATCH] fix panic: Bad field name provided name --- internal/route/rules/rules.go | 2 +- internal/route/types/raw_entry.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/route/rules/rules.go b/internal/route/rules/rules.go index 857e530a..2b2d6dc3 100644 --- a/internal/route/rules/rules.go +++ b/internal/route/rules/rules.go @@ -40,7 +40,7 @@ type ( one match means this line is matched. */ Rule struct { - Name string `json:"name" validate:"required,unique"` + Name string `json:"name" validate:"required"` On RuleOn `json:"on"` Do Command `json:"do"` } diff --git a/internal/route/types/raw_entry.go b/internal/route/types/raw_entry.go index 2670c716..b3a14794 100644 --- a/internal/route/types/raw_entry.go +++ b/internal/route/types/raw_entry.go @@ -31,7 +31,7 @@ type ( Port string `json:"port,omitempty"` NoTLSVerify bool `json:"no_tls_verify,omitempty"` PathPatterns []string `json:"path_patterns,omitempty"` - Rules rules.Rules `json:"rules,omitempty"` + Rules rules.Rules `json:"rules,omitempty" validate:"omitempty,unique=Name"` HealthCheck *health.HealthCheckConfig `json:"healthcheck,omitempty"` LoadBalance *loadbalance.Config `json:"load_balance,omitempty"` Middlewares map[string]docker.LabelMap `json:"middlewares,omitempty"`