make db configurable

This commit is contained in:
2021-10-05 18:16:26 +02:00
parent 835801c0c6
commit 50b44d9762
3 changed files with 9 additions and 1 deletions

View File

@@ -1,6 +1,10 @@
logging:
level: DEBUG
db:
driver: sqlite3
connect_to: "file:csgowtfd.db?_fk=1&cache=shared"
parser:
worker: 6

View File

@@ -374,7 +374,7 @@ func main() {
Lock: new(sync.RWMutex),
}
db.Client, err = ent.Open("sqlite3", "file:csgowtfd.db?_fk=1&cache=shared")
db.Client, err = ent.Open(conf.Db.Driver, conf.Db.ConnectTo)
if err != nil {
log.Panicf("Failed to open database %s: %v", "opencsgo.db", err)
}

View File

@@ -26,6 +26,10 @@ type Conf struct {
Logging struct {
Level string
}
Db struct {
Driver string
ConnectTo string `yaml:"connect_to"`
}
Parser struct {
Worker int
}