haproxy-lb/pkg/config/ca.go
2021-11-07 13:30:22 +01:00

19 lines
262 B
Go

package config
import (
"crypto/x509"
"os"
)
func LoadCertPool(file string) (p *x509.CertPool, err error) {
if file == "" {
return
}
buf, err := os.ReadFile(file)
if err != nil {
return
}
p = x509.NewCertPool()
p.AppendCertsFromPEM(buf)
return
}