From dfe7deff72ec77f798efe243c1c22bb63c523040 Mon Sep 17 00:00:00 2001 From: Georg Pfuetzenreuter Date: Thu, 10 Oct 2024 00:04:16 +0200 Subject: Configurable database path Allow the database file to reside in a user defined location instead of requiring it to be in the working directory. Signed-off-by: Georg Pfuetzenreuter --- wat/db.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'wat/db.go') 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) } -- cgit v1.2.3