mirror of
https://github.com/go-gitea/gitea.git
synced 2026-02-27 09:53:02 +01:00
Fix incorrect setting loading order (#36735)
This commit is contained in:
parent
429ba9c010
commit
75efc51e98
@ -29,8 +29,10 @@ func TestShortSha(t *testing.T) {
|
||||
func TestVerifyTimeLimitCode(t *testing.T) {
|
||||
defer test.MockVariableValue(&setting.InstallLock, true)()
|
||||
initGeneralSecret := func(secret string) {
|
||||
setting.InstallLock = true
|
||||
setting.CfgProvider, _ = setting.NewConfigProviderFromData(fmt.Sprintf(`
|
||||
[security]
|
||||
INTERNAL_TOKEN = dummy
|
||||
INSTALL_LOCK = true
|
||||
[oauth2]
|
||||
JWT_SECRET = %s
|
||||
`, secret))
|
||||
|
||||
@ -109,7 +109,6 @@ func generateSaveInternalToken(rootCfg ConfigProvider) {
|
||||
|
||||
func loadSecurityFrom(rootCfg ConfigProvider) {
|
||||
sec := rootCfg.Section("security")
|
||||
InstallLock = HasInstallLock(rootCfg)
|
||||
LogInRememberDays = sec.Key("LOGIN_REMEMBER_DAYS").MustInt(31)
|
||||
SecretKey = loadSecret(sec, "SECRET_KEY_URI", "SECRET_KEY")
|
||||
if SecretKey == "" {
|
||||
|
||||
@ -108,6 +108,9 @@ func LoadCommonSettings() {
|
||||
|
||||
// loadCommonSettingsFrom loads common configurations from a configuration provider.
|
||||
func loadCommonSettingsFrom(cfg ConfigProvider) error {
|
||||
// a lot of logic depends on InstallLock value, so it must be loaded before any other settings
|
||||
InstallLock = HasInstallLock(cfg)
|
||||
|
||||
// WARNING: don't change the sequence except you know what you are doing.
|
||||
loadRunModeFrom(cfg)
|
||||
loadLogGlobalFrom(cfg)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user