diff options
| author | Fuwn <[email protected]> | 2026-01-19 19:53:36 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-01-19 19:53:36 -0800 |
| commit | 276e6044fd179adf5a51390c0a92b50129196b5a (patch) | |
| tree | 8e18540f530cf72a8f616d2cc9056067fab37440 | |
| parent | docs: Remove completed features from ideas.md (diff) | |
| download | kaze-276e6044fd179adf5a51390c0a92b50129196b5a.tar.xz kaze-276e6044fd179adf5a51390c0a92b50129196b5a.zip | |
fix: Remove duplicate monitor name validation across groups
Previously, monitors with the same name in different groups would fail
validation. This restriction has been removed to allow duplicate names
across groups, restoring the original behavior.
Note: Monitors with duplicate names will share the same data in the
database since MonitorName is used as the identifier. A future
enhancement could use group+name as a composite key.
| -rw-r--r-- | config.example.yaml | 2 | ||||
| -rw-r--r-- | internal/config/config.go | 5 |
2 files changed, 2 insertions, 5 deletions
diff --git a/config.example.yaml b/config.example.yaml index 383c0b4..d751ac5 100644 --- a/config.example.yaml +++ b/config.example.yaml @@ -195,6 +195,8 @@ incidents: # # Common fields for all monitor types: # name: string (required) - Display name for the monitor +# NOTE: Duplicate names across groups are allowed but will share +# the same monitoring data in the database # type: string (required) - Monitor type: http, https, tcp, gemini, icmp, dns, or graphql # target: string (required) - URL, host:port, IP address, or domain to monitor # interval: duration - Check interval (default: 30s, or group default) diff --git a/internal/config/config.go b/internal/config/config.go index 71a9b99..f3c35e3 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -288,7 +288,6 @@ func (c *Config) validate() error { return fmt.Errorf("at least one group with monitors is required") } - monitorNames := make(map[string]bool) for _, group := range c.Groups { if group.Name == "" { return fmt.Errorf("group name cannot be empty") @@ -300,10 +299,6 @@ func (c *Config) validate() error { if monitor.Name == "" { return fmt.Errorf("monitor name cannot be empty in group %q", group.Name) } - if monitorNames[monitor.Name] { - return fmt.Errorf("duplicate monitor name: %q", monitor.Name) - } - monitorNames[monitor.Name] = true if monitor.Target == "" { return fmt.Errorf("monitor %q must have a target", monitor.Name) |