From 89d00d09860f06a41c9ac7ef0fe63f4382491fe4 Mon Sep 17 00:00:00 2001 From: soup Date: Mon, 30 Oct 2023 23:04:53 +0100 Subject: [PATCH] fix(config): prevent overwriting default logPath (#1219) * fix(config): prevent overwriting logPath default * Fix duplication issue * fix: Preserve non-empty logPath value in config --- internal/config/config.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/config/config.go b/internal/config/config.go index 3d16db6..263edc2 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -316,7 +316,13 @@ func (c *AppConfig) processLines(lines []string) []string { } if !foundLineLogPath && strings.Contains(line, "logPath =") { if c.Config.LogPath == "" { - lines[i] = `#logPath = ""` + // Check if the line already has a value + matches := strings.Split(line, "=") + if len(matches) > 1 && strings.TrimSpace(matches[1]) != `""` { + lines[i] = line // Preserve the existing line + } else { + lines[i] = `#logPath = ""` + } } else { lines[i] = fmt.Sprintf("logPath = \"%s\"", c.Config.LogPath) }