fix(config): stop mutating shared config structs during parsing
Prevent data loss and nil panics across 5 parse functions: - chain: nil-guard hop entries to avoid deref on empty YAML lists - hop: build merged metadata map instead of writing inherited values into the original NodeConfig; swap+restore around ParseNode call - node: use local connCfg/dialCfg instead of overwriting cfg.Connector and cfg.Dialer fields; only fill in Type when empty - parser: preserve existing config file fields when env vars override Level/Addr (was replacing the entire struct) - router: only update ipNet from dst CIDR if parse succeeds, keeping the route.Net fallback instead of overwriting with nil
This commit is contained in:
@@ -33,6 +33,10 @@ func ParseChain(cfg *config.ChainConfig, log logger.Logger) (chain.Chainer, erro
|
||||
)
|
||||
|
||||
for _, ch := range cfg.Hops {
|
||||
if ch == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
var hop hop.Hop
|
||||
var err error
|
||||
|
||||
|
||||
Reference in New Issue
Block a user