Fix config initialization
This commit is contained in:
parent
5269b7989c
commit
b91c5d2d69
@ -38,8 +38,7 @@ var stateSnapshotCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func stateSnapshot() {
|
func stateSnapshot() {
|
||||||
snapConfig := &snapshot.Config{}
|
snapConfig := snapshot.NewConfig()
|
||||||
snapConfig.Init()
|
|
||||||
pgDB, err := snapshot.NewPostgresDB(snapConfig.DB)
|
pgDB, err := snapshot.NewPostgresDB(snapConfig.DB)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logWithCommand.Fatal(err)
|
logWithCommand.Fatal(err)
|
||||||
|
@ -30,6 +30,12 @@ const (
|
|||||||
LVL_DB_PATH = "LVL_DB_PATH"
|
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.
|
// DBConfig is config parameters for DB.
|
||||||
type DBConfig struct {
|
type DBConfig struct {
|
||||||
Node ethNode.Info
|
Node ethNode.Info
|
||||||
@ -43,9 +49,10 @@ type EthConfig struct {
|
|||||||
AncientDBPath string
|
AncientDBPath string
|
||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
func NewConfig() *Config {
|
||||||
DB *DBConfig
|
ret := &Config{&DBConfig{}, &EthConfig{}}
|
||||||
Eth *EthConfig
|
ret.Init()
|
||||||
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init Initialises config
|
// Init Initialises config
|
||||||
|
Loading…
Reference in New Issue
Block a user