From 423ef5c4b101a91248eeb0945b0852fc671bcc9f Mon Sep 17 00:00:00 2001 From: ycc Date: Fri, 9 Feb 2024 23:28:43 +0100 Subject: [PATCH] Update badger db path --- client/identity.go | 2 +- client/serverstorage.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/client/identity.go b/client/identity.go index e3e7b81..dfe7abf 100644 --- a/client/identity.go +++ b/client/identity.go @@ -279,7 +279,7 @@ func (id *Identity) SaveBackgroundJob() error { if err != nil { return err } - err = os.WriteFile(filepath.Join(GetConfig().StoragePath, ".jobs"), jsonjobs, 0644) + err = os.WriteFile(filepath.Join(GetConfig().StoragePath, ".jobs"), jsonjobs, 0600) if err != nil { return err } diff --git a/client/serverstorage.go b/client/serverstorage.go index aa236c6..a5800d5 100644 --- a/client/serverstorage.go +++ b/client/serverstorage.go @@ -6,6 +6,7 @@ package client import ( "crypto/sha256" "encoding/json" + "path/filepath" "forge.redroom.link/yves/meowlib" "github.com/dgraph-io/badger" @@ -18,7 +19,7 @@ type ServerStorage struct { // Open a badger database from struct ServerStorage func (ss *ServerStorage) open() error { - opts := badger.DefaultOptions(ss.DbFile) + opts := badger.DefaultOptions(filepath.Join(GetConfig().StoragePath, ss.DbFile)) opts.Logger = nil var err error ss.db, err = badger.Open(opts)