diff --git a/cli/cmds/root.go b/cli/cmds/root.go index 97eb0921..3a37a24e 100644 --- a/cli/cmds/root.go +++ b/cli/cmds/root.go @@ -92,10 +92,10 @@ func CobraFlagNamespace(appCtx *AppContext, flag *pflag.FlagSet) { } func InitializeConfig(cmd *cobra.Command) { - // Use a "K3KCLI" prefix so that only namespaced environment variables (e.g. - // K3KCLI_VERSION) bind to flags. Without a prefix, common environment variables + // Use a "K3K" prefix so that only namespaced environment variables (e.g. + // K3K_VERSION) bind to flags. Without a prefix, common environment variables // such as VERSION, MODE or TOKEN would silently override the matching CLI flags. - viper.SetEnvPrefix("K3KCLI") + viper.SetEnvPrefix("K3K") viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_")) viper.AutomaticEnv() diff --git a/cli/cmds/root_test.go b/cli/cmds/root_test.go index b4d8ee43..eecc48f0 100644 --- a/cli/cmds/root_test.go +++ b/cli/cmds/root_test.go @@ -21,7 +21,7 @@ func Test_InitializeConfig_envPrefix(t *testing.T) { }, { name: "prefixed env binds to flag", - envName: "K3KCLI_VERSION", + envName: "K3K_VERSION", want: "1h", }, }