From 71d2a6a41a7fea7a71efa125f47567b5cb5ba56a Mon Sep 17 00:00:00 2001 From: Giteabot Date: Sat, 24 Jun 2023 10:04:50 -0400 Subject: Use InitWorkPathAndCfgProvider for environment-to-ini to avoid unnecessary checks (#25480) (#25488) Backport #25480 by @wxiaoguang Fix #25481 The `InitWorkPathAndCommonConfig` calls `LoadCommonSettings` which does many checks like "current user is root or not". Some commands like "environment-to-ini" shouldn't do such check, because it might be run with "root" user at the moment (eg: the docker's setup script) ps: in the future, the docker's setup script should be improved to avoid Gitea's command running with "root" Co-authored-by: wxiaoguang --- contrib/environment-to-ini/environment-to-ini.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contrib') diff --git a/contrib/environment-to-ini/environment-to-ini.go b/contrib/environment-to-ini/environment-to-ini.go index 2cdf4e3943..230ed58269 100644 --- a/contrib/environment-to-ini/environment-to-ini.go +++ b/contrib/environment-to-ini/environment-to-ini.go @@ -88,7 +88,7 @@ func main() { } func runEnvironmentToIni(c *cli.Context) error { - setting.InitWorkPathAndCommonConfig(os.Getenv, setting.ArgWorkPathAndCustomConf{ + setting.InitWorkPathAndCfgProvider(os.Getenv, setting.ArgWorkPathAndCustomConf{ WorkPath: c.String("work-path"), CustomPath: c.String("custom-path"), CustomConf: c.String("config"), -- cgit v1.2.3