cosmos-sdk/server/v2/api/rest/config.go
Randy Grok e666764af6
feat: wire v2 handlers (#22112)
Co-authored-by: Randy Grok <@faulttolerance.net>
Co-authored-by: Julien Robert <julien@rbrt.fr>
2024-10-16 14:21:18 +00:00

33 lines
880 B
Go

package rest
func DefaultConfig() *Config {
return &Config{
Enable: true,
Address: "localhost:8080",
}
}
type CfgOption func(*Config)
// Config defines configuration for the REST server.
type Config struct {
// Enable defines if the REST server should be enabled.
Enable bool `mapstructure:"enable" toml:"enable" comment:"Enable defines if the REST server should be enabled."`
// Address defines the API server to listen on
Address string `mapstructure:"address" toml:"address" comment:"Address defines the REST server address to bind to."`
}
// OverwriteDefaultConfig overwrites the default config with the new config.
func OverwriteDefaultConfig(newCfg *Config) CfgOption {
return func(cfg *Config) {
*cfg = *newCfg
}
}
// Disable the rest server by default (default enabled).
func Disable() CfgOption {
return func(cfg *Config) {
cfg.Enable = false
}
}