diff options
author | Unknown <joe2010xtmf@163.com> | 2014-03-21 01:09:22 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-03-21 01:09:22 -0400 |
commit | 369ddf76a8ae6916ab72f1fa26c81b44c456c6ea (patch) | |
tree | 3e26392ef3ff4569cc077432e507e848f907df8a /models/models.go | |
parent | 53a17bbd240e0dd3755b7a666792d69e358f3e00 (diff) | |
download | gitea-369ddf76a8ae6916ab72f1fa26c81b44c456c6ea.tar.gz gitea-369ddf76a8ae6916ab72f1fa26c81b44c456c6ea.zip |
Batch fix
Diffstat (limited to 'models/models.go')
-rw-r--r-- | models/models.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/models/models.go b/models/models.go index 214d1c767a..8df230975f 100644 --- a/models/models.go +++ b/models/models.go @@ -7,6 +7,7 @@ package models import ( "fmt" "os" + "path" _ "github.com/go-sql-driver/mysql" _ "github.com/lib/pq" @@ -23,6 +24,7 @@ func setEngine() { dbName := base.Cfg.MustValue("database", "NAME") dbUser := base.Cfg.MustValue("database", "USER") dbPwd := base.Cfg.MustValue("database", "PASSWD") + dbPath := base.Cfg.MustValue("database", "PATH", "data/gogs.db") sslMode := base.Cfg.MustValue("database", "SSL_MODE") var err error @@ -33,6 +35,9 @@ func setEngine() { case "postgres": orm, err = xorm.NewEngine("postgres", fmt.Sprintf("user=%s password=%s dbname=%s sslmode=%s", dbUser, dbPwd, dbName, sslMode)) + case "sqlite3": + os.MkdirAll(path.Dir(dbPath), os.ModePerm) + orm, err = xorm.NewEngine("sqlite3", dbPath) default: fmt.Printf("Unknown database type: %s\n", dbType) os.Exit(2) |