mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-23 20:35:24 +01:00
fix(be): returns store according configuration
This commit is contained in:
parent
cca0e95dea
commit
c9f64b51cf
@ -3,11 +3,21 @@ package factory
|
||||
import (
|
||||
"github.com/ansible-semaphore/semaphore/db"
|
||||
"github.com/ansible-semaphore/semaphore/db/bolt"
|
||||
|
||||
//"github.com/ansible-semaphore/semaphore/db/sql"
|
||||
"github.com/ansible-semaphore/semaphore/db/sql"
|
||||
"github.com/ansible-semaphore/semaphore/util"
|
||||
)
|
||||
|
||||
func CreateStore() db.Store {
|
||||
return &bolt.BoltDb{}
|
||||
//return &sql.SqlDb{}
|
||||
config, err := util.Config.GetDBConfig()
|
||||
if err != nil {
|
||||
panic("Can not read configuration")
|
||||
}
|
||||
switch config.Dialect {
|
||||
case util.DbDriverMySQL:
|
||||
return &sql.SqlDb{}
|
||||
case util.DbDriverBolt:
|
||||
return &bolt.BoltDb{}
|
||||
default:
|
||||
panic("Unsupported database dialect")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user