summaryrefslogtreecommitdiffstats
path: root/wat
diff options
context:
space:
mode:
Diffstat (limited to 'wat')
-rw-r--r--wat/bot.go3
-rw-r--r--wat/db.go4
2 files changed, 4 insertions, 3 deletions
diff --git a/wat/bot.go b/wat/bot.go
index ffa6d8b..806906c 100644
--- a/wat/bot.go
+++ b/wat/bot.go
@@ -20,6 +20,7 @@ type WatBot struct {
}
type WatConfig struct {
+ DatabasePath string
BotHosts []string
BotGames BotGameConfig
AdminHosts []string
@@ -30,7 +31,7 @@ type WatConfig struct {
func NewWatBot(config *irc.ClientConfig, watConfig *WatConfig, serverConn *tls.Conn) *WatBot {
wat := WatBot{conn: serverConn, Nick: config.Nick, c: watConfig}
- wat.Db = NewWatDb()
+ wat.Db = NewWatDb(watConfig.DatabasePath)
wat.game = NewWatGame(&wat, wat.Db)
wat.integration = NewWatIntegration(&wat, wat.Db, &WatIntegrationConfig{BotHosts: watConfig.BotHosts, BotGames: watConfig.BotGames})
config.Handler = irc.HandlerFunc(wat.HandleIrcMsg)
diff --git a/wat/db.go b/wat/db.go
index 8971223..cd59892 100644
--- a/wat/db.go
+++ b/wat/db.go
@@ -52,10 +52,10 @@ type WatDb struct {
db *gorm.DB
}
-func NewWatDb() *WatDb {
+func NewWatDb(dbpath string) *WatDb {
w := WatDb{}
var err error
- w.db, err = gorm.Open(sqlite.Open("wat.db"), &gorm.Config{})
+ w.db, err = gorm.Open(sqlite.Open(dbpath), &gorm.Config{})
if err != nil {
panic(err)
}