Skip to content

Commit f47c268

Browse files
twpaynehalostatue
andcommittedOct 10, 2023
feat: Warn when overriding CHEZMOI_ env vars
Co-authored-by: Austin Ziegler <austin@zieglers.ca>
1 parent 7203d6b commit f47c268

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed
 

‎internal/cmd/config.go

+3
Original file line numberDiff line numberDiff line change
@@ -2125,6 +2125,9 @@ func (c *Config) persistentPreRunRootE(cmd *cobra.Command, args []string) error
21252125
}
21262126
}
21272127
for key, value := range c.ScriptEnv {
2128+
if strings.HasPrefix(key, "CHEZMOI_") {
2129+
c.errorf("warning: %s: overriding reserved environment variable", key)
2130+
}
21282131
os.Setenv(key, value)
21292132
}
21302133

0 commit comments

Comments
 (0)
Please sign in to comment.