mirror of https://github.com/usememos/memos.git
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
This commit is contained in:
parent
f827296d6b
commit
d4ad1dde17
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue