Open
Description
Feature Description
Gitea's config system has various issues:
- Environment variables are not recognized, unless environment-to-ini is loaded, which currently only runs for docker deployments.
- There are two places to define a default value and it causes bugs, as seen in this PR.
- There is ambiguity between casing, e.g.
Enabled
in the config struct, vsENABLED
in the.Key
definition.
I would propose treating environment variables as first-class, so the following steps could be taken:
- Move environment-to-ini into the main code base so environment variables are recognized at all times.
- Use https://github.com/kelseyhightower/envconfig to parse the environment to config structs. The structs should have original case and format of the variables, so a config variable remains greppable, so it should be
config.APP_NAME
instead ofconfig.AppName
. - Have a separate mechanism that parses the ini and map values to the already initialized config struct, but not overwrite existing values because environment variables must have precedence over ini values.