]> source.dussan.org Git - gitea.git/commitdiff
Make environment-to-ini work with INSTALL_LOCK=true (#25926) (#25937)
authorGiteabot <teabot@gitea.io>
Mon, 17 Jul 2023 18:28:54 +0000 (14:28 -0400)
committerGitHub <noreply@github.com>
Mon, 17 Jul 2023 18:28:54 +0000 (18:28 +0000)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
fix #25924

contrib/environment-to-ini/environment-to-ini.go

index e472384a950b48e224bbe7e0b09a0d399e2c7362..fb5fb7bdadd236e2cd8b05b5829f729618384331 100644 (file)
@@ -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")