mirror of
https://github.com/safing/portbase
synced 2025-09-11 07:44:43 +00:00
Make DB registry persistence optional
This increases resilience when persistence is not needed.
This commit is contained in:
parent
fda2943c0a
commit
6fcd1d3ef7
3 changed files with 18 additions and 11 deletions
|
@ -40,14 +40,13 @@ func Initialize(dirStructureRoot *utils.DirStructure) error {
|
|||
return fmt.Errorf("could not create/open database directory (%s): %s", rootStructure.Path, err)
|
||||
}
|
||||
|
||||
err = loadRegistry()
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not load database registry (%s): %s", filepath.Join(rootStructure.Path, registryFileName), err)
|
||||
if registryPersistence.IsSet() {
|
||||
err = loadRegistry()
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not load database registry (%s): %s", filepath.Join(rootStructure.Path, registryFileName), err)
|
||||
}
|
||||
}
|
||||
|
||||
// start registry writer
|
||||
go registryWriter()
|
||||
|
||||
return nil
|
||||
}
|
||||
return errors.New("database already initialized")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue