Skip to content

Commit

Permalink
Provide filesystem for JSON store
Browse files Browse the repository at this point in the history
  • Loading branch information
ioppermann committed Feb 12, 2024
1 parent 00c5ad3 commit 85b2c9b
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions app/ffmigrate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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("")
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 85b2c9b

Please sign in to comment.