Fix timing on database root path initialization
This commit is contained in:
@@ -4,8 +4,8 @@ import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/safing/portmaster/base/database"
|
||||
"github.com/safing/portmaster/base/database/dbmodule"
|
||||
_ "github.com/safing/portmaster/base/database/storage/bbolt"
|
||||
"github.com/safing/portmaster/base/dataroot"
|
||||
"github.com/safing/portmaster/base/utils"
|
||||
)
|
||||
|
||||
@@ -17,7 +17,7 @@ var (
|
||||
func registerDatabases() error {
|
||||
// If there is an existing bbolt core database, use it instead.
|
||||
coreStorageType := DefaultDatabaseStorageType
|
||||
if utils.PathExists(filepath.Join(dbmodule.GetDatabaseLocation(), "core", "bbolt")) {
|
||||
if utils.PathExists(filepath.Join(dataroot.Root().Path, database.DatabasesSubDir, "core", "bbolt")) {
|
||||
coreStorageType = "bbolt"
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ func registerDatabases() error {
|
||||
|
||||
// If there is an existing cache bbolt database, use it instead.
|
||||
cacheStorageType := DefaultDatabaseStorageType
|
||||
if utils.PathExists(filepath.Join(dbmodule.GetDatabaseLocation(), "cache", "bbolt")) {
|
||||
if utils.PathExists(filepath.Join(dataroot.Root().Path, database.DatabasesSubDir, "cache", "bbolt")) {
|
||||
cacheStorageType = "bbolt"
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/safing/portmaster/base/api"
|
||||
"github.com/safing/portmaster/base/database/dbmodule"
|
||||
"github.com/safing/portmaster/base/dataroot"
|
||||
"github.com/safing/portmaster/base/info"
|
||||
"github.com/safing/portmaster/base/utils"
|
||||
@@ -59,6 +60,9 @@ func prep(instance instance) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Set root dir for the databases.
|
||||
dbmodule.SetDatabaseLocation(dataroot.Root())
|
||||
}
|
||||
|
||||
// set api listen address
|
||||
|
||||
Reference in New Issue
Block a user