refactor: db location

Signed-off-by: skidoodle <contact@albert.lol>
This commit is contained in:
2026-01-19 00:44:03 +01:00
parent 2df37e9002
commit 2bcf339408
6 changed files with 29 additions and 8 deletions
+7 -1
View File
@@ -1,6 +1,7 @@
package app
import (
"os"
"path/filepath"
"time"
@@ -15,7 +16,12 @@ type FileMeta struct {
}
func InitDB(storageDir string) (*bbolt.DB, error) {
path := filepath.Join(storageDir, DBFileName)
dbDir := filepath.Join(storageDir, DBDirName)
if err := os.MkdirAll(dbDir, PermUserRWX); err != nil {
return nil, err
}
path := filepath.Join(dbDir, DBFileName)
db, err := bbolt.Open(path, 0600, &bbolt.Options{Timeout: 1 * time.Second})
if err != nil {
return nil, err