From 0c354cebc620e26b2ef83ebbac83262cebed3563 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Mon, 17 Oct 2022 23:20:48 +0800 Subject: [PATCH 1/2] Fix read system configuration bug when installing --- routers/install/install.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/routers/install/install.go b/routers/install/install.go index 8a0d34d97631..8d8490f048f1 100644 --- a/routers/install/install.go +++ b/routers/install/install.go @@ -149,19 +149,9 @@ func Install(ctx *context.Context) { // Server and other services settings form.OfflineMode = setting.OfflineMode - disableGravatarSetting, _ := system_model.GetSetting(system_model.KeyPictureDisableGravatar) - if disableGravatarSetting != nil { - form.DisableGravatar = disableGravatarSetting.GetValueBool() - } else { - form.DisableGravatar = false - } + form.DisableGravatar = false // when installing, there is no database connection so that given a default value + form.EnableFederatedAvatar = false // when installing, there is no database connection so that given a default value - enableFederatedAvatarSetting, _ := system_model.GetSetting(system_model.KeyPictureEnableFederatedAvatar) - if enableFederatedAvatarSetting != nil { - form.EnableFederatedAvatar = enableFederatedAvatarSetting.GetValueBool() - } else { - form.EnableFederatedAvatar = false - } form.EnableOpenIDSignIn = setting.Service.EnableOpenIDSignIn form.EnableOpenIDSignUp = setting.Service.EnableOpenIDSignUp form.DisableRegistration = setting.Service.DisableRegistration From 14012d0097d3542aa825cccb5750ccfbc1af9775 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Tue, 18 Oct 2022 00:22:22 +0800 Subject: [PATCH 2/2] Fix bug when installing --- routers/install/install.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/routers/install/install.go b/routers/install/install.go index 8d8490f048f1..962dee8c8609 100644 --- a/routers/install/install.go +++ b/routers/install/install.go @@ -375,7 +375,6 @@ func SubmitInstall(ctx *context.Context) { ctx.RenderWithErr(ctx.Tr("install.invalid_db_setting", err), tplInstall, &form) return } - db.UnsetDefaultEngine() // Save settings. cfg := ini.Empty() @@ -508,6 +507,9 @@ func SubmitInstall(ctx *context.Context) { return } + // unset default engine before reload database setting + db.UnsetDefaultEngine() + // ---- All checks are passed // Reload settings (and re-initialize database connection)