|
|
@ -66,6 +66,7 @@ var (
|
|
|
|
// DbCfg holds the database settings
|
|
|
|
// DbCfg holds the database settings
|
|
|
|
DbCfg struct {
|
|
|
|
DbCfg struct {
|
|
|
|
Type, Host, Name, User, Passwd, Path, SSLMode string
|
|
|
|
Type, Host, Name, User, Passwd, Path, SSLMode string
|
|
|
|
|
|
|
|
Timeout int
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// EnableSQLite3 use SQLite3
|
|
|
|
// EnableSQLite3 use SQLite3
|
|
|
@ -151,6 +152,7 @@ func LoadConfigs() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DbCfg.SSLMode = sec.Key("SSL_MODE").String()
|
|
|
|
DbCfg.SSLMode = sec.Key("SSL_MODE").String()
|
|
|
|
DbCfg.Path = sec.Key("PATH").MustString("data/gitea.db")
|
|
|
|
DbCfg.Path = sec.Key("PATH").MustString("data/gitea.db")
|
|
|
|
|
|
|
|
DbCfg.Timeout = sec.Key("SQLITE_TIMEOUT").MustInt(500)
|
|
|
|
|
|
|
|
|
|
|
|
sec = setting.Cfg.Section("indexer")
|
|
|
|
sec = setting.Cfg.Section("indexer")
|
|
|
|
setting.Indexer.IssuePath = sec.Key("ISSUE_INDEXER_PATH").MustString("indexers/issues.bleve")
|
|
|
|
setting.Indexer.IssuePath = sec.Key("ISSUE_INDEXER_PATH").MustString("indexers/issues.bleve")
|
|
|
@ -220,7 +222,7 @@ func getEngine() (*xorm.Engine, error) {
|
|
|
|
if err := os.MkdirAll(path.Dir(DbCfg.Path), os.ModePerm); err != nil {
|
|
|
|
if err := os.MkdirAll(path.Dir(DbCfg.Path), os.ModePerm); err != nil {
|
|
|
|
return nil, fmt.Errorf("Failed to create directories: %v", err)
|
|
|
|
return nil, fmt.Errorf("Failed to create directories: %v", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
connStr = "file:" + DbCfg.Path + "?cache=shared&mode=rwc"
|
|
|
|
connStr = fmt.Sprintf("file:%s?cache=shared&mode=rwc&_busy_timeout=%d", DbCfg.Path, DbCfg.Timeout)
|
|
|
|
case "tidb":
|
|
|
|
case "tidb":
|
|
|
|
if !EnableTiDB {
|
|
|
|
if !EnableTiDB {
|
|
|
|
return nil, errors.New("this binary version does not build support for TiDB")
|
|
|
|
return nil, errors.New("this binary version does not build support for TiDB")
|
|
|
|