From 740187e0299bd7613d1957130ed1eb3592e18681 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Mon, 17 Jul 2023 17:41:40 +0800 Subject: [PATCH] fix --- contrib/environment-to-ini/environment-to-ini.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/environment-to-ini/environment-to-ini.go b/contrib/environment-to-ini/environment-to-ini.go index e472384a950b4..fb5fb7bdadd23 100644 --- a/contrib/environment-to-ini/environment-to-ini.go +++ b/contrib/environment-to-ini/environment-to-ini.go @@ -75,6 +75,8 @@ func main() { } func runEnvironmentToIni(c *cli.Context) error { + // the config system may change the environment variables, so get a copy first, to be used later + env := append([]string{}, os.Environ()...) setting.InitWorkPathAndCfgProvider(os.Getenv, setting.ArgWorkPathAndCustomConf{ WorkPath: c.String("work-path"), CustomPath: c.String("custom-path"), @@ -86,7 +88,7 @@ func runEnvironmentToIni(c *cli.Context) error { log.Fatal("Failed to load custom conf '%s': %v", setting.CustomConf, err) } - changed := setting.EnvironmentToConfig(cfg, os.Environ()) + changed := setting.EnvironmentToConfig(cfg, env) // try to save the config file destination := c.String("out")