Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1159 update state sync configs #1160

Merged
merged 5 commits into from
Jan 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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