From 10221b54716c0129b5ba90fbe21fd3bef3015c93 Mon Sep 17 00:00:00 2001 From: Deluan Date: Fri, 10 Jan 2020 22:03:22 -0500 Subject: [PATCH] Force dbPath to be relative to main executable --- persistence/db_storm/storm.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/persistence/db_storm/storm.go b/persistence/db_storm/storm.go index 8fa284f5f..7102b2472 100644 --- a/persistence/db_storm/storm.go +++ b/persistence/db_storm/storm.go @@ -1,7 +1,10 @@ package db_storm import ( + "fmt" + "os" "path" + "path/filepath" "sync" "github.com/asdine/storm" @@ -16,7 +19,12 @@ var ( func Db() *storm.DB { once.Do(func() { + err := os.MkdirAll(conf.Sonic.DbPath, 0700) + if err != nil { + panic(err) + } dbPath := path.Join(conf.Sonic.DbPath, "storm.db") + dbPath = fmt.Sprintf(".%c%s", filepath.Separator, dbPath) instance, err := storm.Open(dbPath) log.Debug("Opening Storm DB from: " + dbPath) if err != nil {