aboutsummaryrefslogtreecommitdiffstats
path: root/internal/database
diff options
context:
space:
mode:
authorLibravatar Mo Tarbin <mhed.t91@gmail.com>2024-07-09 18:31:25 -0400
committerLibravatar Mo Tarbin <mhed.t91@gmail.com>2024-07-09 18:31:25 -0400
commita6ace0db337948e940dfa430e780edccf25eabc9 (patch)
tree25dc5107a4bb878f5f2af684388c750202e1b727 /internal/database
parenta3fa964c585f62ccf4c4113da1dc324839122c88 (diff)
parent2d538ff43c9b73223e4af8f8668d0f4f1412e3ab (diff)
downloaddonetick-a6ace0db337948e940dfa430e780edccf25eabc9.tar.gz
donetick-a6ace0db337948e940dfa430e780edccf25eabc9.tar.bz2
donetick-a6ace0db337948e940dfa430e780edccf25eabc9.zip
Merge branch 'dev'
Diffstat (limited to '')
-rw-r--r--internal/database/database.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/internal/database/database.go b/internal/database/database.go
index 8fc8a68..67818db 100644
--- a/internal/database/database.go
+++ b/internal/database/database.go
@@ -2,6 +2,7 @@ package database
import (
"fmt"
+ "os"
"time"
"gorm.io/driver/postgres"
@@ -33,7 +34,12 @@ func NewDatabase(cfg *config.Config) (*gorm.DB, error) {
default:
- db, err = gorm.Open(sqlite.Open("donetick.db"), &gorm.Config{})
+ path := os.Getenv("DT_SQLITE_PATH")
+ if path == "" {
+ db, err = gorm.Open(sqlite.Open("donetick.db"), &gorm.Config{})
+ } else {
+ db, err = gorm.Open(sqlite.Open(path), &gorm.Config{})
+ }
}