File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,8 +29,10 @@ func TestShortSha(t *testing.T) {
2929func TestVerifyTimeLimitCode (t * testing.T ) {
3030 defer test .MockVariableValue (& setting .InstallLock , true )()
3131 initGeneralSecret := func (secret string ) {
32- setting .InstallLock = true
3332 setting .CfgProvider , _ = setting .NewConfigProviderFromData (fmt .Sprintf (`
33+ [security]
34+ INTERNAL_TOKEN = dummy
35+ INSTALL_LOCK = true
3436[oauth2]
3537JWT_SECRET = %s
3638` , secret ))
Original file line number Diff line number Diff line change @@ -109,7 +109,6 @@ func generateSaveInternalToken(rootCfg ConfigProvider) {
109109
110110func loadSecurityFrom (rootCfg ConfigProvider ) {
111111 sec := rootCfg .Section ("security" )
112- InstallLock = HasInstallLock (rootCfg )
113112 LogInRememberDays = sec .Key ("LOGIN_REMEMBER_DAYS" ).MustInt (31 )
114113 SecretKey = loadSecret (sec , "SECRET_KEY_URI" , "SECRET_KEY" )
115114 if SecretKey == "" {
Original file line number Diff line number Diff line change @@ -108,6 +108,9 @@ func LoadCommonSettings() {
108108
109109// loadCommonSettingsFrom loads common configurations from a configuration provider.
110110func loadCommonSettingsFrom (cfg ConfigProvider ) error {
111+ // a lot of logic depends on InstallLock value, so it must be loaded before any other settings
112+ InstallLock = HasInstallLock (cfg )
113+
111114 // WARNING: don't change the sequence except you know what you are doing.
112115 loadRunModeFrom (cfg )
113116 loadLogGlobalFrom (cfg )
You can’t perform that action at this time.
0 commit comments