parent
8ee9922fe6
commit
f1ad4bb3d5
2 changed files with 5 additions and 19 deletions
|
@ -8,7 +8,6 @@ import (
|
|||
"errors"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
|
@ -45,9 +44,6 @@ func InstallInit(ctx *context.Context) {
|
|||
if models.EnableSQLite3 {
|
||||
dbOpts = append(dbOpts, "SQLite3")
|
||||
}
|
||||
if models.EnableTiDB {
|
||||
dbOpts = append(dbOpts, "TiDB")
|
||||
}
|
||||
ctx.Data["DbOptions"] = dbOpts
|
||||
}
|
||||
|
||||
|
@ -72,10 +68,6 @@ func Install(ctx *context.Context) {
|
|||
if models.EnableSQLite3 {
|
||||
ctx.Data["CurDbOption"] = "SQLite3"
|
||||
}
|
||||
case "tidb":
|
||||
if models.EnableTiDB {
|
||||
ctx.Data["CurDbOption"] = "TiDB"
|
||||
}
|
||||
}
|
||||
|
||||
// Application general settings
|
||||
|
@ -151,7 +143,7 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
|
|||
|
||||
// Pass basic check, now test configuration.
|
||||
// Test database setting.
|
||||
dbTypes := map[string]string{"MySQL": "mysql", "PostgreSQL": "postgres", "MSSQL": "mssql", "SQLite3": "sqlite3", "TiDB": "tidb"}
|
||||
dbTypes := map[string]string{"MySQL": "mysql", "PostgreSQL": "postgres", "MSSQL": "mssql", "SQLite3": "sqlite3"}
|
||||
models.DbCfg.Type = dbTypes[form.DbType]
|
||||
models.DbCfg.Host = form.DbHost
|
||||
models.DbCfg.User = form.DbUser
|
||||
|
@ -160,16 +152,11 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
|
|||
models.DbCfg.SSLMode = form.SSLMode
|
||||
models.DbCfg.Path = form.DbPath
|
||||
|
||||
if (models.DbCfg.Type == "sqlite3" || models.DbCfg.Type == "tidb") &&
|
||||
if (models.DbCfg.Type == "sqlite3") &&
|
||||
len(models.DbCfg.Path) == 0 {
|
||||
ctx.Data["Err_DbPath"] = true
|
||||
ctx.RenderWithErr(ctx.Tr("install.err_empty_db_path"), tplInstall, &form)
|
||||
return
|
||||
} else if models.DbCfg.Type == "tidb" &&
|
||||
strings.ContainsAny(path.Base(models.DbCfg.Path), ".-") {
|
||||
ctx.Data["Err_DbPath"] = true
|
||||
ctx.RenderWithErr(ctx.Tr("install.err_invalid_tidb_name"), tplInstall, &form)
|
||||
return
|
||||
}
|
||||
|
||||
// Set test engine.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue