summaryrefslogtreecommitdiffstats
path: root/models/models.go
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-12-31 18:37:29 +0800
committerUnknwon <joe2010xtmf@163.com>2014-12-31 18:37:29 +0800
commitbd555551ce6d4b26cbce14b778b05d573b4aa4a4 (patch)
tree8185c6dccf18c45a5a59b8403e361bda805c93b3 /models/models.go
parente1c5008238c144e9946398379a9e50fc8f284bec (diff)
downloadgitea-bd555551ce6d4b26cbce14b778b05d573b4aa4a4.tar.gz
gitea-bd555551ce6d4b26cbce14b778b05d573b4aa4a4.zip
fix #801
Diffstat (limited to 'models/models.go')
-rw-r--r--models/models.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/models/models.go b/models/models.go
index 677f9ba9d7..cf2124417a 100644
--- a/models/models.go
+++ b/models/models.go
@@ -49,18 +49,19 @@ func init() {
}
func LoadModelsConfig() {
- DbCfg.Type = setting.Cfg.MustValue("database", "DB_TYPE")
+ sec := setting.Cfg.Section("database")
+ DbCfg.Type = sec.Key("DB_TYPE").String()
if DbCfg.Type == "sqlite3" {
UseSQLite3 = true
}
- DbCfg.Host = setting.Cfg.MustValue("database", "HOST")
- DbCfg.Name = setting.Cfg.MustValue("database", "NAME")
- DbCfg.User = setting.Cfg.MustValue("database", "USER")
+ DbCfg.Host = sec.Key("HOST").String()
+ DbCfg.Name = sec.Key("NAME").String()
+ DbCfg.User = sec.Key("USER").String()
if len(DbCfg.Pwd) == 0 {
- DbCfg.Pwd = setting.Cfg.MustValue("database", "PASSWD")
+ DbCfg.Pwd = sec.Key("PASSWD").String()
}
- DbCfg.SslMode = setting.Cfg.MustValue("database", "SSL_MODE")
- DbCfg.Path = setting.Cfg.MustValue("database", "PATH", "data/gogs.db")
+ DbCfg.SslMode = sec.Key("SSL_MODE").String()
+ DbCfg.Path = sec.Key("PATH").MustString("data/gogs.db")
}
func getEngine() (*xorm.Engine, error) {