Fix -autoconf

This commit is contained in:
Neil Alexander 2023-05-20 10:54:49 +01:00
parent a233e775eb
commit e290e744f4
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944

View File

@ -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)