Skip to content

Commit f0182d8

Browse files
lunny6543
andauthored
Fix read system configuration bug when installing (#21489)
Fix #18058 (comment) Co-authored-by: 6543 <[email protected]>
1 parent 20a5452 commit f0182d8

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

routers/install/install.go

+5-13
Original file line numberDiff line numberDiff line change
@@ -149,19 +149,9 @@ func Install(ctx *context.Context) {
149149

150150
// Server and other services settings
151151
form.OfflineMode = setting.OfflineMode
152-
disableGravatarSetting, _ := system_model.GetSetting(system_model.KeyPictureDisableGravatar)
153-
if disableGravatarSetting != nil {
154-
form.DisableGravatar = disableGravatarSetting.GetValueBool()
155-
} else {
156-
form.DisableGravatar = false
157-
}
152+
form.DisableGravatar = false // when installing, there is no database connection so that given a default value
153+
form.EnableFederatedAvatar = false // when installing, there is no database connection so that given a default value
158154

159-
enableFederatedAvatarSetting, _ := system_model.GetSetting(system_model.KeyPictureEnableFederatedAvatar)
160-
if enableFederatedAvatarSetting != nil {
161-
form.EnableFederatedAvatar = enableFederatedAvatarSetting.GetValueBool()
162-
} else {
163-
form.EnableFederatedAvatar = false
164-
}
165155
form.EnableOpenIDSignIn = setting.Service.EnableOpenIDSignIn
166156
form.EnableOpenIDSignUp = setting.Service.EnableOpenIDSignUp
167157
form.DisableRegistration = setting.Service.DisableRegistration
@@ -385,7 +375,6 @@ func SubmitInstall(ctx *context.Context) {
385375
ctx.RenderWithErr(ctx.Tr("install.invalid_db_setting", err), tplInstall, &form)
386376
return
387377
}
388-
db.UnsetDefaultEngine()
389378

390379
// Save settings.
391380
cfg := ini.Empty()
@@ -518,6 +507,9 @@ func SubmitInstall(ctx *context.Context) {
518507
return
519508
}
520509

510+
// unset default engine before reload database setting
511+
db.UnsetDefaultEngine()
512+
521513
// ---- All checks are passed
522514

523515
// Reload settings (and re-initialize database connection)

0 commit comments

Comments
 (0)