Fix panic on GetCertificate

Fixes the following panic:

    panic: interface conversion: interface {} is tls.Certificate, not *tls.Certificate
This commit is contained in:
Simon Ser 2021-03-19 09:27:19 +01:00
parent 21e9fe9b3c
commit c0513013d5

View File

@ -57,7 +57,7 @@ func main() {
if err != nil { if err != nil {
log.Fatalf("failed to load TLS certificate and key: %v", err) log.Fatalf("failed to load TLS certificate and key: %v", err)
} }
tlsCert.Store(cert) tlsCert.Store(&cert)
tlsCfg = &tls.Config{ tlsCfg = &tls.Config{
GetCertificate: func(*tls.ClientHelloInfo) (*tls.Certificate, error) { GetCertificate: func(*tls.ClientHelloInfo) (*tls.Certificate, error) {
@ -204,7 +204,7 @@ func main() {
log.Printf("failed to reload TLS certificate and key: %v", err) log.Printf("failed to reload TLS certificate and key: %v", err)
break break
} }
tlsCert.Store(cert) tlsCert.Store(&cert)
} }
case syscall.SIGINT, syscall.SIGTERM: case syscall.SIGINT, syscall.SIGTERM:
log.Print("shutting down server") log.Print("shutting down server")