forked from forgejo/forgejo
Backport #25395 by @wxiaoguang That's a longstanding INI package problem: the "MustXxx" calls change the option values, and the following "Save" will save a lot of garbage options into the user's config file. Ideally we should refactor the INI package to a clear solution, but it's a huge work. A clear workaround is what this PR does: when "Save", load a clear INI instance and save it. Partially fix #25377, the "install" page needs more fine tunes. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
parent
6f1c95ec5b
commit
8302b95d6b
7 changed files with 94 additions and 16 deletions
|
@ -202,6 +202,7 @@ func Init(opts *Options) {
|
|||
}
|
||||
var err error
|
||||
CfgProvider, err = NewConfigProviderFromFile(opts)
|
||||
CfgProvider.DisableSaving() // do not allow saving the CfgProvider into file, it will be polluted by the "MustXxx" calls
|
||||
if err != nil {
|
||||
log.Fatal("newConfigProviderFromFile[%v]: %v", opts, err)
|
||||
}
|
||||
|
@ -214,7 +215,7 @@ func Init(opts *Options) {
|
|||
|
||||
// loadCommonSettingsFrom loads common configurations from a configuration provider.
|
||||
func loadCommonSettingsFrom(cfg ConfigProvider) error {
|
||||
// WARNNING: don't change the sequence except you know what you are doing.
|
||||
// WARNING: don't change the sequence except you know what you are doing.
|
||||
loadRunModeFrom(cfg)
|
||||
loadLogGlobalFrom(cfg)
|
||||
loadServerFrom(cfg)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue