Skip to content

Commit

Permalink
feat: Warn when overriding CHEZMOI_ env vars
Browse files Browse the repository at this point in the history
Co-authored-by: Austin Ziegler <austin@zieglers.ca>
  • Loading branch information
twpayne and halostatue committed Oct 10, 2023
1 parent 7203d6b commit f47c268
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/cmd/config.go
Expand Up @@ -2125,6 +2125,9 @@ func (c *Config) persistentPreRunRootE(cmd *cobra.Command, args []string) error
}
}
for key, value := range c.ScriptEnv {
if strings.HasPrefix(key, "CHEZMOI_") {
c.errorf("warning: %s: overriding reserved environment variable", key)
}
os.Setenv(key, value)
}

Expand Down

0 comments on commit f47c268

Please sign in to comment.