Add configurable path to database and docker-compose sample
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user