summaryrefslogtreecommitdiffstats
path: root/routers/init.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-08-24 17:24:45 +0800
committerAntoine GIRARD <sapk@users.noreply.github.com>2019-08-24 11:24:45 +0200
commitf83db078f0603c775cd1b1bb016f996b65a04835 (patch)
tree9895f852c768d43b384ba36259b44d9506b04093 /routers/init.go
parent26af3401c36e6316b81b92bf6a776bf2442d251c (diff)
downloadgitea-f83db078f0603c775cd1b1bb016f996b65a04835.tar.gz
gitea-f83db078f0603c775cd1b1bb016f996b65a04835.zip
Move database settings from models to setting (#7806)
* move database settings from models to setting * update docs * fix checkout pr * fix tests * fix lint * remove unsupported tidb options * correct wrong variable name * remove tidb totally
Diffstat (limited to 'routers/init.go')
-rw-r--r--routers/init.go19
1 files changed, 8 insertions, 11 deletions
diff --git a/routers/init.go b/routers/init.go
index 4724da8627..fdf90904ce 100644
--- a/routers/init.go
+++ b/routers/init.go
@@ -47,16 +47,16 @@ func NewServices() {
// In case of problems connecting to DB, retry connection. Eg, PGSQL in Docker Container on Synology
func initDBEngine() (err error) {
log.Info("Beginning ORM engine initialization.")
- for i := 0; i < setting.DBConnectRetries; i++ {
- log.Info("ORM engine initialization attempt #%d/%d...", i+1, setting.DBConnectRetries)
+ for i := 0; i < setting.Database.DBConnectRetries; i++ {
+ log.Info("ORM engine initialization attempt #%d/%d...", i+1, setting.Database.DBConnectRetries)
if err = models.NewEngine(migrations.Migrate); err == nil {
break
- } else if i == setting.DBConnectRetries-1 {
+ } else if i == setting.Database.DBConnectRetries-1 {
return err
}
- log.Error("ORM engine initialization attempt #%d/%d failed. Error: %v", i+1, setting.DBConnectRetries, err)
- log.Info("Backing off for %d seconds", int64(setting.DBConnectBackoff/time.Second))
- time.Sleep(setting.DBConnectBackoff)
+ log.Error("ORM engine initialization attempt #%d/%d failed. Error: %v", i+1, setting.Database.DBConnectRetries, err)
+ log.Info("Backing off for %d seconds", int64(setting.Database.DBConnectBackoff/time.Second))
+ time.Sleep(setting.Database.DBConnectBackoff)
}
models.HasEngine = true
return nil
@@ -73,7 +73,7 @@ func GlobalInit() {
log.Trace("AppWorkPath: %s", setting.AppWorkPath)
log.Trace("Custom path: %s", setting.CustomPath)
log.Trace("Log path: %s", setting.LogRootPath)
- models.LoadConfigs()
+
NewServices()
if setting.InstallLock {
@@ -102,12 +102,9 @@ func GlobalInit() {
models.InitDeliverHooks()
models.InitTestPullRequests()
}
- if models.EnableSQLite3 {
+ if setting.EnableSQLite3 {
log.Info("SQLite3 Supported")
}
- if models.EnableTiDB {
- log.Info("TiDB Supported")
- }
checkRunMode()
if setting.InstallLock && setting.SSH.StartBuiltinServer {