From 82f4f7beed8c5bea07bdd8b9fb21f06cd39a4971 Mon Sep 17 00:00:00 2001 From: LordMathis Date: Sun, 19 Oct 2025 18:47:02 +0200 Subject: [PATCH] Ensure local node is defined in LoadConfig by adding default config if missing --- pkg/config/config.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index 7ce87cf..517a3c3 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -150,9 +150,7 @@ func LoadConfig(configPath string) (AppConfig, error) { EnableSwagger: false, }, LocalNode: "main", - Nodes: map[string]NodeConfig{ - "main": {}, // Local node with empty config - }, + Nodes: map[string]NodeConfig{}, Backends: BackendConfig{ LlamaCpp: BackendSettings{ Command: "llama-server", @@ -217,6 +215,11 @@ func LoadConfig(configPath string) (AppConfig, error) { return cfg, err } + // If local node is not defined in nodes, add it with default config + if _, ok := cfg.Nodes[cfg.LocalNode]; !ok { + cfg.Nodes[cfg.LocalNode] = NodeConfig{} + } + // 3. Override with environment variables loadEnvVars(&cfg)