Skip to content

Commit db1f63f

Browse files
committed
fix
1 parent 429ba9c commit db1f63f

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

modules/base/tool_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ func TestShortSha(t *testing.T) {
2929
func 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]
3537
JWT_SECRET = %s
3638
`, secret))

modules/setting/security.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ func generateSaveInternalToken(rootCfg ConfigProvider) {
109109

110110
func 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 == "" {

modules/setting/setting.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ func LoadCommonSettings() {
108108

109109
// loadCommonSettingsFrom loads common configurations from a configuration provider.
110110
func 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)

0 commit comments

Comments
 (0)