Update badger db path
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
ycc 2024-02-09 23:28:43 +01:00
parent b87c0bff3e
commit 423ef5c4b1
2 changed files with 3 additions and 2 deletions

View File

@ -279,7 +279,7 @@ func (id *Identity) SaveBackgroundJob() error {
if err != nil { if err != nil {
return err 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 { if err != nil {
return err return err
} }

View File

@ -6,6 +6,7 @@ package client
import ( import (
"crypto/sha256" "crypto/sha256"
"encoding/json" "encoding/json"
"path/filepath"
"forge.redroom.link/yves/meowlib" "forge.redroom.link/yves/meowlib"
"github.com/dgraph-io/badger" "github.com/dgraph-io/badger"
@ -18,7 +19,7 @@ type ServerStorage struct {
// Open a badger database from struct ServerStorage // Open a badger database from struct ServerStorage
func (ss *ServerStorage) open() error { func (ss *ServerStorage) open() error {
opts := badger.DefaultOptions(ss.DbFile) opts := badger.DefaultOptions(filepath.Join(GetConfig().StoragePath, ss.DbFile))
opts.Logger = nil opts.Logger = nil
var err error var err error
ss.db, err = badger.Open(opts) ss.db, err = badger.Open(opts)