Files
Matheus Sampaio Queiroga d388b862a0 Add env loader in gitea
Signed-off-by: Matheus Sampaio Queiroga <srherobrine20@gmail.com>
2025-02-25 20:37:36 -03:00

27 lines
1.1 KiB
Diff

diff --git a/cmd/main.go b/cmd/main.go
index 7251bd09a3..e83732bc52 100644
--- a/cmd/main.go
+++ b/cmd/main.go
@@ -104,6 +104,7 @@ func prepareWorkPathAndCustomConf(action cli.ActionFunc) func(ctx *cli.Context)
}
}
setting.InitWorkPathAndCommonConfig(os.Getenv, args)
+ setting.EnvironmentToConfig(setting.CfgProvider, os.Environ()) // Add config from env
if ctx.Bool("help") || action == nil {
// the default behavior of "urfave/cli": "nil action" means "show help"
return cmdHelp().Action(ctx)
diff --git a/modules/setting/config_env.go b/modules/setting/config_env.go
index 5d94a9641f..1223cc76a1 100644
--- a/modules/setting/config_env.go
+++ b/modules/setting/config_env.go
@@ -121,6 +121,9 @@ func EnvironmentToConfig(cfg ConfigProvider, envs []string) (changed bool) {
envValue := kv[idx+1:]
ok, sectionName, keyName, useFileValue := decodeEnvironmentKey(EnvConfigKeyPrefixGitea, EnvConfigKeySuffixFile, envKey)
if !ok {
+ if sectionName != "" || keyName != "" {
+ log.Info("Ignoring [%q]%q=%q", sectionName, keyName, envValue)
+ }
continue
}