summaryrefslogtreecommitdiffstats
path: root/routers/install
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2022-10-18 23:16:58 +0800
committerGitHub <noreply@github.com>2022-10-18 23:16:58 +0800
commitf0182d88402c68c4032bd5314680ef4bee1f16ea (patch)
tree869e3a547820e0970300284b99cad3d20170b22c /routers/install
parent20a5452ea64e73b921b56d39195c71514c14f3c3 (diff)
downloadgitea-f0182d88402c68c4032bd5314680ef4bee1f16ea.tar.gz
gitea-f0182d88402c68c4032bd5314680ef4bee1f16ea.zip
Fix read system configuration bug when installing (#21489)
Fix https://github.com/go-gitea/gitea/pull/18058#issuecomment-1280944311 Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'routers/install')
-rw-r--r--routers/install/install.go18
1 files changed, 5 insertions, 13 deletions
diff --git a/routers/install/install.go b/routers/install/install.go
index 8a0d34d976..962dee8c86 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
@@ -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()
@@ -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)