Skip to content

Commit

Permalink
1159 update state sync configs (#1160)
Browse files Browse the repository at this point in the history
* Update default snapshot configs

* Refactor

* Fix override to include default template

Co-authored-by: billy rennekamp <billy.rennekamp@gmail.com>
  • Loading branch information
glnro and okwme authored Jan 19, 2022
1 parent 694061e commit e287dbf
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion cmd/gaiad/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/cosmos/cosmos-sdk/client/keys"
"github.com/cosmos/cosmos-sdk/client/rpc"
"github.com/cosmos/cosmos-sdk/server"
serverconfig "github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/cosmos/cosmos-sdk/snapshots"
"github.com/cosmos/cosmos-sdk/store"
Expand Down Expand Up @@ -61,7 +62,8 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
return err
}

return server.InterceptConfigsPreRunHandler(cmd, "", nil)
customTemplate, customGaiaConfig := initAppConfig()
return server.InterceptConfigsPreRunHandler(cmd, customTemplate, customGaiaConfig)
},
}

Expand All @@ -70,8 +72,27 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
return rootCmd, encodingConfig
}

func initAppConfig() (string, interface{}) {

type CustomAppConfig struct {
serverconfig.Config
}

// Allow overrides to the SDK default server config
srvCfg := serverconfig.DefaultConfig()
srvCfg.StateSync.SnapshotInterval = 1000
srvCfg.StateSync.SnapshotKeepRecent = 10

GaiaAppCfg := CustomAppConfig{Config: *srvCfg}

GaiaAppTemplate := serverconfig.DefaultConfigTemplate

return GaiaAppTemplate, GaiaAppCfg
}

func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) {
cfg := sdk.GetConfig()

cfg.Seal()

rootCmd.AddCommand(
Expand Down

0 comments on commit e287dbf

Please sign in to comment.