mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-12-22 07:57:31 +00:00
Fix private key setup when certificate not specified
This commit is contained in:
parent
5e684550a8
commit
002b984c04
@ -151,7 +151,14 @@ func (cfg *NodeConfig) postprocessConfig() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if cfg.Certificate == nil {
|
switch {
|
||||||
|
case cfg.Certificate == nil:
|
||||||
|
// No self-signed certificate has been generated yet.
|
||||||
|
fallthrough
|
||||||
|
case !bytes.Equal(cfg.Certificate.PrivateKey.(ed25519.PrivateKey), cfg.PrivateKey):
|
||||||
|
// A self-signed certificate was generated but the private
|
||||||
|
// key has changed since then, possibly because a new config
|
||||||
|
// was parsed.
|
||||||
if err := cfg.GenerateSelfSignedCertificate(); err != nil {
|
if err := cfg.GenerateSelfSignedCertificate(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user