From f05fc9ada832ca46ec53dab828f7b0a417bac271 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 7 Aug 2025 14:26:37 +0530 Subject: [PATCH 1/2] config: prevent empty values for required configs Fixes #147 Signed-off-by: Abhishek Kumar --- config/config.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/config/config.go b/config/config.go index 91632aa..4b0878d 100644 --- a/config/config.go +++ b/config/config.go @@ -45,6 +45,13 @@ const ( DEFAULT = "default" ) +var NonEmptyConfigKeys = map[string]bool{ + "output": true, + "timeout": true, + "profile": true, + "url": true, +} + // DefaultACSAPIEndpoint is the default API endpoint for CloudStack. const DefaultACSAPIEndpoint = "http://localhost:8080/client/api" From 414b1ab4721bc1de2fad27f193e69f78b1437e7a Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 7 Aug 2025 14:30:31 +0530 Subject: [PATCH 2/2] fix Signed-off-by: Abhishek Kumar --- config/config.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 4b0878d..483a478 100644 --- a/config/config.go +++ b/config/config.go @@ -45,7 +45,7 @@ const ( DEFAULT = "default" ) -var NonEmptyConfigKeys = map[string]bool{ +var nonEmptyConfigKeys = map[string]bool{ "output": true, "timeout": true, "profile": true, @@ -354,6 +354,10 @@ func (c *Config) LoadProfile(name string) { // UpdateConfig updates and saves config func (c *Config) UpdateConfig(key string, value string, update bool) { + if nonEmptyConfigKeys[key] && value == "" { + fmt.Printf("Error: value for '%s' must not be empty\n", key) + return + } switch key { case "prompt": c.Core.Prompt = value