From e290e744f4c8d729a8086854d16ecf16deeb7978 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sat, 20 May 2023 10:54:49 +0100 Subject: [PATCH] Fix `-autoconf` --- src/config/config.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/config/config.go b/src/config/config.go index 76f7476..1980cb2 100644 --- a/src/config/config.go +++ b/src/config/config.go @@ -84,7 +84,9 @@ func GenerateConfig() *NodeConfig { cfg.IfName = defaults.DefaultIfName cfg.IfMTU = defaults.DefaultIfMTU cfg.NodeInfoPrivacy = false - + if err := cfg.postprocessConfig(); err != nil { + panic(err) + } return cfg } @@ -122,6 +124,10 @@ func (cfg *NodeConfig) UnmarshalHJSON(b []byte) error { if err := hjson.Unmarshal(b, cfg); err != nil { return err } + return cfg.postprocessConfig() +} + +func (cfg *NodeConfig) postprocessConfig() error { if cfg.PrivateKeyPath != "" { cfg.PrivateKey = nil f, err := os.ReadFile(cfg.PrivateKeyPath)