Skip to content

Commit

Permalink
pkg/cosmos/cmd/chainlink-cosmos: validate config and set defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 committed Feb 3, 2025
1 parent 5c53138 commit 9bb642c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pkg/cosmos/cmd/chainlink-cosmos/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,22 @@ func (c *pluginRelayer) NewRelayer(ctx context.Context, config string, keystore
if err := d.Decode(&cfg); err != nil {
return nil, fmt.Errorf("failed to decode config toml: %w:\n\t%s", err, config)
}
cfg.SetDefaults()
if err := cfg.ValidateConfig(); err != nil {
return nil, fmt.Errorf("config is invalid: %w", err)
}

cfgStr, err := cfg.TOMLString()
if err != nil {
return nil, fmt.Errorf("failed to serialize config: %w", err)
}
c.Logger.Infow("Creating relayer", "config", cfgStr)

opts := cosmos.ChainOpts{
chain, err := cosmos.NewChain(&cfg, cosmos.ChainOpts{
Logger: c.Logger,
KeyStore: keystore,
DS: c.ds,
}
chain, err := cosmos.NewChain(&cfg, opts)
})
if err != nil {
return nil, fmt.Errorf("failed to create chain: %w", err)
}
Expand Down

0 comments on commit 9bb642c

Please sign in to comment.