diff --git a/cmd/stateSnapshot.go b/cmd/stateSnapshot.go index ba910f3..119be17 100644 --- a/cmd/stateSnapshot.go +++ b/cmd/stateSnapshot.go @@ -38,8 +38,7 @@ var stateSnapshotCmd = &cobra.Command{ } func stateSnapshot() { - snapConfig := &snapshot.Config{} - snapConfig.Init() + snapConfig := snapshot.NewConfig() pgDB, err := snapshot.NewPostgresDB(snapConfig.DB) if err != nil { logWithCommand.Fatal(err) diff --git a/pkg/snapshot/config.go b/pkg/snapshot/config.go index c8b00d2..4c20199 100644 --- a/pkg/snapshot/config.go +++ b/pkg/snapshot/config.go @@ -30,6 +30,12 @@ const ( LVL_DB_PATH = "LVL_DB_PATH" ) +// Config contains params for both databases the service uses +type Config struct { + DB *DBConfig + Eth *EthConfig +} + // DBConfig is config parameters for DB. type DBConfig struct { Node ethNode.Info @@ -43,9 +49,10 @@ type EthConfig struct { AncientDBPath string } -type Config struct { - DB *DBConfig - Eth *EthConfig +func NewConfig() *Config { + ret := &Config{&DBConfig{}, &EthConfig{}} + ret.Init() + return ret } // Init Initialises config