Commit Graph

6 Commits (4971a1054317ae68b1eb59a3dc30f61c7503dadc)

Author SHA1 Message Date
wxiaoguang b4d0036fc3
Do not prepare oauth2 config if it is not enabled, do not write config in some sub-commands ()
Ref:

* https://github.com/go-gitea/gitea/issues/25377#issuecomment-1609757289

And some sub-commands like "generate" / "docs", they do not need to use
the ini config
techknowlogick c0fc53e226
Import additional secrets via file uri ()
wxiaoguang df5cf5ddbd
Avoid polluting config file when "save" ()
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 , the "install" page needs more fine tunes.
wxiaoguang a5d0246fff
Avoid polluting the config ()
Caught by 

Co-authored-by: Giteabot <teabot@gitea.io>
Lunny Xiao 5cf7da63ee
Refactor config provider ()
This PR introduces more abstract about `ConfigProvider` and hides more `ini` references.

---------

Co-authored-by: delvh <dev.lh@web.de>
Lunny Xiao c53ad052d8
Refactor the setting to make unit test easier ()
Some bugs caused by less unit tests in fundamental packages. This PR
refactor `setting` package so that create a unit test will be easier
than before.

- All `LoadFromXXX` files has been splited as two functions, one is
`InitProviderFromXXX` and `LoadCommonSettings`. The first functions will
only include the code to create or new a ini file. The second function
will load common settings.
- It also renames all functions in setting from `newXXXService` to
`loadXXXSetting` or `loadXXXFrom` to make the function name less
confusing.
- Move `XORMLog` to `SQLLog` because it's a better name for that.

Maybe we should finally move these `loadXXXSetting` into the `XXXInit`
function? Any idea?

---------

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: delvh <dev.lh@web.de>