diff --git a/cmd/createSnapshot.go b/cmd/createSnapshot.go
index 4372875e..50cad5eb 100644
--- a/cmd/createSnapshot.go
+++ b/cmd/createSnapshot.go
@@ -6,7 +6,6 @@ import (
"github.com/Layr-Labs/sidecar/internal/config"
"github.com/Layr-Labs/sidecar/internal/logger"
"github.com/Layr-Labs/sidecar/pkg/snapshot"
- "github.com/Layr-Labs/sidecar/pkg/utils"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/spf13/viper"
@@ -25,13 +24,8 @@ var createSnapshotCmd = &cobra.Command{
return fmt.Errorf("failed to initialize logger: %w", err)
}
- outputFile, err := utils.ExpandHomeDir(cfg.SnapshotConfig.OutputFile)
- if err != nil {
- return err
- }
-
- svc := snapshot.NewSnapshotService(&snapshot.SnapshotConfig{
- OutputFile: outputFile,
+ svc, err := snapshot.NewSnapshotService(&snapshot.SnapshotConfig{
+ OutputFile: cfg.SnapshotConfig.OutputFile,
Host: cfg.DatabaseConfig.Host,
Port: cfg.DatabaseConfig.Port,
User: cfg.DatabaseConfig.User,
@@ -39,6 +33,9 @@ var createSnapshotCmd = &cobra.Command{
DbName: cfg.DatabaseConfig.DbName,
SchemaName: cfg.DatabaseConfig.SchemaName,
}, l)
+ if err != nil {
+ return err
+ }
if err := svc.CreateSnapshot(); err != nil {
return fmt.Errorf("failed to create snapshot: %w", err)
diff --git a/cmd/restoreSnapshot.go b/cmd/restoreSnapshot.go
index 58f5c836..4b6d8a4a 100644
--- a/cmd/restoreSnapshot.go
+++ b/cmd/restoreSnapshot.go
@@ -6,7 +6,6 @@ import (
"github.com/Layr-Labs/sidecar/internal/config"
"github.com/Layr-Labs/sidecar/internal/logger"
"github.com/Layr-Labs/sidecar/pkg/snapshot"
- "github.com/Layr-Labs/sidecar/pkg/utils"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/spf13/viper"
@@ -28,13 +27,8 @@ Follow the snapshot docs if you need to convert the snapshot to a different sche
return fmt.Errorf("failed to initialize logger: %w", err)
}
- inputFile, err := utils.ExpandHomeDir(cfg.SnapshotConfig.InputFile)
- if err != nil {
- return err
- }
-
- svc := snapshot.NewSnapshotService(&snapshot.SnapshotConfig{
- InputFile: inputFile,
+ svc, err := snapshot.NewSnapshotService(&snapshot.SnapshotConfig{
+ InputFile: cfg.SnapshotConfig.InputFile,
Host: cfg.DatabaseConfig.Host,
Port: cfg.DatabaseConfig.Port,
User: cfg.DatabaseConfig.User,
@@ -42,6 +36,9 @@ Follow the snapshot docs if you need to convert the snapshot to a different sche
DbName: cfg.DatabaseConfig.DbName,
SchemaName: cfg.DatabaseConfig.SchemaName,
}, l)
+ if err != nil {
+ return err
+ }
if err := svc.RestoreSnapshot(); err != nil {
return fmt.Errorf("failed to restore snapshot: %w", err)
diff --git a/docs/snapshots_docs.md b/docs/snapshots_docs.md
index d9d546b8..f7962a98 100644
--- a/docs/snapshots_docs.md
+++ b/docs/snapshots_docs.md
@@ -114,7 +114,7 @@ Commonly the input schema is
psql -c "CREATE DATABASE temp_sidecar_dump_schema_conversion_db;"
# Use the Sidecar CLI to restore the snapshot dump into the temporary database:
-go run main.go restore-snapshot \
+./bin/sidecar restore-snapshot \
--database.host=localhost \
--database.user=... \
--database.password=... \
@@ -127,7 +127,7 @@ go run main.go restore-snapshot \
psql -d temp_sidecar_dump_schema_conversion_db -c "ALTER SCHEMA RENAME TO