aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-01-20 05:30:49 -0800
committerFuwn <[email protected]>2026-01-20 05:30:49 -0800
commit82ae61c1bb80a91b0fd868530088cd79cb40579f (patch)
treed8a6008a3ddac2a5a1136cf7f0973f798139473b
parentfeat: Add database connection monitoring type (diff)
downloadkaze-82ae61c1bb80a91b0fd868530088cd79cb40579f.tar.xz
kaze-82ae61c1bb80a91b0fd868530088cd79cb40579f.zip
fix: Add database type to config validation
-rw-r--r--internal/config/config.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index 5b9d468..9cc9eac 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -314,16 +314,19 @@ func (c *Config) validate() error {
}
switch monitor.Type {
- case "http", "https", "tcp", "gemini", "icmp", "dns", "graphql":
+ case "http", "https", "tcp", "gemini", "icmp", "dns", "graphql", "database", "db":
// Valid types
default:
- return fmt.Errorf("monitor %q has invalid type %q (must be http, https, tcp, gemini, icmp, dns, or graphql)", monitor.Name, monitor.Type)
+ return fmt.Errorf("monitor %q has invalid type %q (must be http, https, tcp, gemini, icmp, dns, graphql, or database)", monitor.Name, monitor.Type)
}
// Type-specific validation
if monitor.Type == "graphql" && monitor.GraphQLQuery == "" {
return fmt.Errorf("monitor %q is type 'graphql' but missing required 'graphql_query' field", monitor.Name)
}
+ if (monitor.Type == "database" || monitor.Type == "db") && monitor.DBType == "" {
+ return fmt.Errorf("monitor %q is type 'database' but missing required 'db_type' field", monitor.Name)
+ }
}
}