use env var for db path

This commit is contained in:
filifa 2024-03-19 20:31:32 -05:00
parent 6bc4e06c8f
commit 9b480b8d40
1 changed files with 3 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import (
_ "github.com/mattn/go-sqlite3" _ "github.com/mattn/go-sqlite3"
"log" "log"
"math" "math"
"os"
"strconv" "strconv"
"time" "time"
) )
@ -110,9 +111,10 @@ func main() {
ulimit = t ulimit = t
} }
dbpath := os.Getenv("XBIT_DB")
var db TimelineDB var db TimelineDB
var err error var err error
db.DB, err = sql.Open("sqlite3", "./timeline.db") db.DB, err = sql.Open("sqlite3", dbpath)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }