diff --git a/chain/westend/defaults.go b/chain/westend/defaults.go index 0a1c9d8b57..d11169f67f 100644 --- a/chain/westend/defaults.go +++ b/chain/westend/defaults.go @@ -21,6 +21,8 @@ var ( DefaultConfig = string("./chain/westend/config.toml") // DefaultBasePath Default node base directory path DefaultBasePath = string("~/.gossamer/westend") + // DefaultMetricsAddress is the default metrics server listening address. + DefaultMetricsAddress = "localhost:9876" // DefaultLvl is the default log level DefaultLvl = log.Info diff --git a/cmd/gossamer/config.go b/cmd/gossamer/config.go index d88c30c8b1..f246bf73d8 100644 --- a/cmd/gossamer/config.go +++ b/cmd/gossamer/config.go @@ -28,6 +28,7 @@ var ( defaultKusamaConfigPath = "./chain/kusama/config.toml" defaultPolkadotConfigPath = "./chain/polkadot/config.toml" defaultWestendDevConfigPath = "./chain/westend-dev/config.toml" + defaultWestendConfigPath = "./chain/westend/config.toml" ) // loadConfigFile loads a default config file if --chain is specified, a specific @@ -77,6 +78,11 @@ func setupConfigFromChain(ctx *cli.Context) (*ctoml.Config, *dot.Config, error) tomlCfg = &ctoml.Config{} cfg = dot.WestendDevConfig() err = loadConfig(tomlCfg, defaultWestendDevConfigPath) + case "westend": + logger.Info("loading toml configuration from " + defaultWestendConfigPath + "...") + tomlCfg = &ctoml.Config{} + cfg = dot.WestendConfig() + err = loadConfig(tomlCfg, defaultWestendConfigPath) default: return nil, nil, fmt.Errorf("unknown chain id provided: %s", id) } diff --git a/dot/config.go b/dot/config.go index a84ef5afa3..78c0b196fa 100644 --- a/dot/config.go +++ b/dot/config.go @@ -10,6 +10,7 @@ import ( "github.com/ChainSafe/gossamer/chain/kusama" "github.com/ChainSafe/gossamer/chain/polkadot" + "github.com/ChainSafe/gossamer/chain/westend" "github.com/ChainSafe/gossamer/dot/state/pruner" "github.com/ChainSafe/gossamer/dot/types" "github.com/ChainSafe/gossamer/internal/log" @@ -361,3 +362,60 @@ func PolkadotConfig() *Config { }, } } + +// WestendConfig returns a "westend" node configuration +func WestendConfig() *Config { + return &Config{ + Global: GlobalConfig{ + Name: westend.DefaultName, + ID: westend.DefaultID, + BasePath: westend.DefaultBasePath, + LogLvl: westend.DefaultLvl, + RetainBlocks: westend.DefaultRetainBlocks, + Pruning: pruner.Mode(westend.DefaultPruningMode), + MetricsAddress: westend.DefaultMetricsAddress, + TelemetryURLs: westend.DefaultTelemetryURLs, + }, + Log: LogConfig{ + CoreLvl: westend.DefaultLvl, + DigestLvl: westend.DefaultLvl, + SyncLvl: westend.DefaultLvl, + NetworkLvl: westend.DefaultLvl, + RPCLvl: westend.DefaultLvl, + StateLvl: westend.DefaultLvl, + RuntimeLvl: westend.DefaultLvl, + BlockProducerLvl: westend.DefaultLvl, + FinalityGadgetLvl: westend.DefaultLvl, + }, + Init: InitConfig{ + Genesis: westend.DefaultGenesis, + }, + Account: AccountConfig{ + Key: westend.DefaultKey, + Unlock: westend.DefaultUnlock, + }, + Core: CoreConfig{ + Roles: westend.DefaultRoles, + WasmInterpreter: westend.DefaultWasmInterpreter, + }, + Network: NetworkConfig{ + Port: westend.DefaultNetworkPort, + Bootnodes: westend.DefaultNetworkBootnodes, + NoBootstrap: westend.DefaultNoBootstrap, + NoMDNS: westend.DefaultNoMDNS, + }, + RPC: RPCConfig{ + Port: westend.DefaultRPCHTTPPort, + Host: westend.DefaultRPCHTTPHost, + Modules: westend.DefaultRPCModules, + WSPort: westend.DefaultRPCWSPort, + }, + Pprof: PprofConfig{ + Settings: pprof.Settings{ + ListeningAddress: westend.DefaultPprofListeningAddress, + BlockProfileRate: westend.DefaultPprofBlockRate, + MutexProfileRate: westend.DefaultPprofMutexRate, + }, + }, + } +}