From 82ae61c1bb80a91b0fd868530088cd79cb40579f Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 20 Jan 2026 05:30:49 -0800 Subject: fix: Add database type to config validation --- internal/config/config.go | 7 +++++-- 1 file 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) + } } } -- cgit v1.2.3