From d4ad1dde1710deae4f9a287ae11ad3a1edb6ce5d Mon Sep 17 00:00:00 2001 From: x34-dzt Date: Sun, 8 Feb 2026 18:02:01 +0530 Subject: [PATCH] fix: handle underscores in environment variable names Add SetEnvKeyReplacer to map dashes in flag names to underscores in env vars, so MEMOS_INSTANCE_URL and MEMOS_UNIX_SOCK work correctly. Fixes #5597 --- cmd/memos/main.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/memos/main.go b/cmd/memos/main.go index bb182b8f7..55545843a 100644 --- a/cmd/memos/main.go +++ b/cmd/memos/main.go @@ -7,6 +7,7 @@ import ( "net/http" "os" "os/signal" + "strings" "syscall" "github.com/spf13/cobra" @@ -131,6 +132,7 @@ func init() { } viper.SetEnvPrefix("memos") + viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_")) viper.AutomaticEnv() }