Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix read system configuration bug when installing #21489

Merged
merged 5 commits into from
Oct 18, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions routers/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -385,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()
Expand Down Expand Up @@ -518,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)
Expand Down