diff options
author | Unknown <joe2010xtmf@163.com> | 2014-04-26 22:34:48 -0600 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-04-26 22:34:48 -0600 |
commit | 59d0e73c3507296b31c8e741b44afc7bfe1eb695 (patch) | |
tree | 79970b755e0c5309b0f05dcd45053f91500ba85b /routers/install.go | |
parent | 1badb2bbccfe81303f69f8dedf57c22fb89d4b99 (diff) | |
download | gitea-59d0e73c3507296b31c8e741b44afc7bfe1eb695.tar.gz gitea-59d0e73c3507296b31c8e741b44afc7bfe1eb695.zip |
Batch mirror fix
Diffstat (limited to 'routers/install.go')
-rw-r--r-- | routers/install.go | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/routers/install.go b/routers/install.go index 12182ad300..8ffa9b5d1a 100644 --- a/routers/install.go +++ b/routers/install.go @@ -65,6 +65,10 @@ func GlobalInit() { checkRunMode() } +func renderDbOption(ctx *middleware.Context) { + ctx.Data["DbOptions"] = []string{"MySQL", "PostgreSQL", "SQLite3"} +} + func Install(ctx *middleware.Context, form auth.InstallForm) { if base.InstallLock { ctx.Handle(404, "install.Install", errors.New("Installation is prohibited")) @@ -104,6 +108,13 @@ func Install(ctx *middleware.Context, form auth.InstallForm) { form.AppUrl = base.AppUrl } + renderDbOption(ctx) + curDbValue := "" + if models.EnableSQLite3 { + curDbValue = "SQLite3" // Default when enabled. + } + ctx.Data["CurDbValue"] = curDbValue + auth.AssignForm(form, ctx.Data) ctx.HTML(200, "install") } @@ -117,6 +128,9 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) { ctx.Data["Title"] = "Install" ctx.Data["PageIsInstall"] = true + renderDbOption(ctx) + ctx.Data["CurDbValue"] = form.Database + if ctx.HasError() { ctx.HTML(200, "install") return @@ -129,7 +143,7 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) { // Pass basic check, now test configuration. // Test database setting. - dbTypes := map[string]string{"mysql": "mysql", "pgsql": "postgres", "sqlite": "sqlite3"} + dbTypes := map[string]string{"MySQL": "mysql", "PostgreSQL": "postgres", "SQLite3": "sqlite3"} models.DbCfg.Type = dbTypes[form.Database] models.DbCfg.Host = form.Host models.DbCfg.User = form.User |