From 85b2c9b53d78d15d34ba06f96f5e4a70b1528edf Mon Sep 17 00:00:00 2001 From: Ingo Oppermann Date: Mon, 12 Feb 2024 09:56:40 +0100 Subject: [PATCH] Provide filesystem for JSON store --- app/ffmigrate/main.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/app/ffmigrate/main.go b/app/ffmigrate/main.go index fb45ae5a..5e95ae2e 100644 --- a/app/ffmigrate/main.go +++ b/app/ffmigrate/main.go @@ -34,13 +34,13 @@ func main() { os.Exit(1) } - if err := doMigration(logger, configstore); err != nil { + if err := doMigration(logger, diskfs, configstore); err != nil { logger.Error().WithError(err).Log("Migration failed") os.Exit(1) } } -func doMigration(logger log.Logger, configstore cfgstore.Store) error { +func doMigration(logger log.Logger, fs fs.Filesystem, configstore cfgstore.Store) error { if logger == nil { logger = log.New("") } @@ -94,14 +94,8 @@ func doMigration(logger log.Logger, configstore cfgstore.Store) error { } // Load the existing DB - diskfs, err := fs.NewDiskFilesystem(fs.DiskConfig{}) - if err != nil { - logger.Error().WithError(err).Log("Accessing disk filesystem failed") - return fmt.Errorf("accessing disk filesystem failed: %w", err) - } - datastore, err := store.NewJSON(store.JSONConfig{ - Filesystem: diskfs, + Filesystem: fs, Filepath: cfg.DB.Dir + "/db.json", }) if err != nil {