blob: 2f9abf2d7c404682b844ab89920b5837e4871453 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
package main
import (
"kch42.de/gostuff/mailremind/confhelper"
"kch42.de/gostuff/mailremind/model"
"log"
)
var db model.DBInfo
var dbcon model.DBCon
func initDB() {
dbdrv := confhelper.ConfStringOrFatal(conf, "db", "driver")
dbconf := confhelper.ConfStringOrFatal(conf, "db", "conf")
var ok bool
if db, ok = model.GetDBInfo(dbdrv); !ok {
log.Fatalf("Could not get info for dbdrv %s", dbdrv)
}
var err error
if dbcon, err = db.Connect(dbconf); err != nil {
log.Fatalf("Unable to connect to %s database: %s", dbdrv, err)
}
}
|