use env var for db path

This commit is contained in:
Nick Griffey 2024-02-25 20:07:09 -06:00
parent 3f45e0fbc0
commit df5af22755
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)
} }