Skip to content

Commit 910ba25

Browse files
committed
fix: Explicitly bind environment variables without the JR_ prefix (JR_SYSTEM_DIR, JR_USER_DIR)
1 parent bd680c8 commit 910ba25

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/cmd/root.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,15 @@ func initConfig() {
8181
for _, path := range strings.Split(os.ExpandEnv("$PATH"), ":") {
8282
viper.AddConfigPath(path)
8383
}
84+
8485
viper.SetEnvPrefix(constants.DEFAULT_ENV_PREFIX)
8586
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
8687
viper.AutomaticEnv()
88+
89+
// Explicitly bind environment variables without the JR_ prefix
90+
viper.BindEnv("jr_system_dir", "JR_SYSTEM_DIR")
91+
viper.BindEnv("jr_user_dir", "JR_USER_DIR")
92+
8793
bindFlags(rootCmd, viper.GetViper())
8894
if constants.JR_SYSTEM_DIR == "" {
8995
constants.JR_SYSTEM_DIR = constants.SYSTEM_DIR

0 commit comments

Comments
 (0)