haproxy-lb/pkg/config/ca.go
2020-11-22 12:59:12 +01:00

19 lines
273 B
Go

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