|
|
|
@ -55,39 +55,38 @@ func Install(ctx *middleware.Context, form auth.InstallForm) { |
|
|
|
|
ctx.Data["Title"] = "Install" |
|
|
|
|
ctx.Data["PageIsInstall"] = true |
|
|
|
|
|
|
|
|
|
// Get and assign value to install form.
|
|
|
|
|
if len(form.Host) == 0 { |
|
|
|
|
form.Host = models.DbCfg.Host |
|
|
|
|
} |
|
|
|
|
if len(form.User) == 0 { |
|
|
|
|
form.User = models.DbCfg.User |
|
|
|
|
} |
|
|
|
|
if len(form.Passwd) == 0 { |
|
|
|
|
form.Passwd = models.DbCfg.Pwd |
|
|
|
|
} |
|
|
|
|
if len(form.DatabaseName) == 0 { |
|
|
|
|
form.DatabaseName = models.DbCfg.Name |
|
|
|
|
} |
|
|
|
|
if len(form.DatabasePath) == 0 { |
|
|
|
|
form.DatabasePath = models.DbCfg.Path |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if len(form.RepoRootPath) == 0 { |
|
|
|
|
form.RepoRootPath = base.RepoRootPath |
|
|
|
|
} |
|
|
|
|
if len(form.RunUser) == 0 { |
|
|
|
|
form.RunUser = base.RunUser |
|
|
|
|
} |
|
|
|
|
if len(form.Domain) == 0 { |
|
|
|
|
form.Domain = base.Domain |
|
|
|
|
} |
|
|
|
|
if len(form.AppUrl) == 0 { |
|
|
|
|
form.AppUrl = base.AppUrl |
|
|
|
|
} |
|
|
|
|
if ctx.Req.Method == "GET" { |
|
|
|
|
// Get and assign value to install form.
|
|
|
|
|
if len(form.Host) == 0 { |
|
|
|
|
form.Host = models.DbCfg.Host |
|
|
|
|
} |
|
|
|
|
if len(form.User) == 0 { |
|
|
|
|
form.User = models.DbCfg.User |
|
|
|
|
} |
|
|
|
|
if len(form.Passwd) == 0 { |
|
|
|
|
form.Passwd = models.DbCfg.Pwd |
|
|
|
|
} |
|
|
|
|
if len(form.DatabaseName) == 0 { |
|
|
|
|
form.DatabaseName = models.DbCfg.Name |
|
|
|
|
} |
|
|
|
|
if len(form.DatabasePath) == 0 { |
|
|
|
|
form.DatabasePath = models.DbCfg.Path |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
auth.AssignForm(form, ctx.Data) |
|
|
|
|
if len(form.RepoRootPath) == 0 { |
|
|
|
|
form.RepoRootPath = base.RepoRootPath |
|
|
|
|
} |
|
|
|
|
if len(form.RunUser) == 0 { |
|
|
|
|
form.RunUser = base.RunUser |
|
|
|
|
} |
|
|
|
|
if len(form.Domain) == 0 { |
|
|
|
|
form.Domain = base.Domain |
|
|
|
|
} |
|
|
|
|
if len(form.AppUrl) == 0 { |
|
|
|
|
form.AppUrl = base.AppUrl |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ctx.Req.Method == "GET" { |
|
|
|
|
auth.AssignForm(form, ctx.Data) |
|
|
|
|
ctx.HTML(200, "install") |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
@ -109,7 +108,12 @@ func Install(ctx *middleware.Context, form auth.InstallForm) { |
|
|
|
|
models.DbCfg.Path = form.DatabasePath |
|
|
|
|
|
|
|
|
|
if err := models.NewEngine(); err != nil { |
|
|
|
|
ctx.RenderWithErr("Database setting is not correct: "+err.Error(), "install", &form) |
|
|
|
|
if strings.Contains(err.Error(), `unknown driver "sqlite3"`) { |
|
|
|
|
ctx.RenderWithErr("Your release version does not support SQLite3, please download the official binary version "+ |
|
|
|
|
"from https://github.com/gogits/gogs/wiki/Install-from-binary, NOT the gobuild version.", "install", &form) |
|
|
|
|
} else { |
|
|
|
|
ctx.RenderWithErr("Database setting is not correct: "+err.Error(), "install", &form) |
|
|
|
|
} |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|