Add configurable path to database and docker-compose sample

This commit is contained in:
2022-05-28 19:28:18 +09:30
parent 49288a5b8b
commit 37e3a3fe7c
4 changed files with 31 additions and 6 deletions

View File

@@ -1,6 +1,7 @@
package main
import (
"flag"
"log"
"github.com/tardisx/linkwallet/db"
@@ -10,8 +11,19 @@ import (
func main() {
var dbPath string
flag.StringVar(&dbPath, "db-path", "", "path to the database file")
flag.Parse()
if dbPath == "" {
log.Fatal("You need to specify the path to the database file with -db-path")
}
dbh := db.DB{}
dbh.Open("badger")
err := dbh.Open(dbPath)
if err != nil {
log.Fatal(err)
}
bmm := db.NewBookmarkManager(&dbh)
cmm := db.NewConfigManager(&dbh)