func (pl PEMLoader) LoadCertificates() ([]Certificate, error) {
	certs := make([]Certificate, 0, len(pl))
	for i, pair := range pl {
		cert, err := tls.X509KeyPair([]byte(pair.CertificatePEM), []byte(pair.KeyPEM))
		if err != nil {
			return nil, fmt.Errorf("PEM pair %d: %v", i, err)
		}
		certs = append(certs, Certificate{
			Certificate: cert,
			Tags:        pair.Tags,
		})
	}
	return certs, nil
}
LoadCertificates returns the certificates contained in pl.
package caddytls
import (
	"crypto/tls"
	"fmt"
	"github.com/caddyserver/caddy/v2"
)
func init() {
	caddy.RegisterModule(PEMLoader{})
}
type PEMLoader []CertKeyPEMPair
func (PEMLoader) CaddyModule() caddy.ModuleInfo {
	return caddy.ModuleInfo{
		ID:  "tls.certificates.load_pem",
		New: func() caddy.Module { return new(PEMLoader) },
	}
}
type CertKeyPEMPair struct {
	CertificatePEM string `json:"certificate"`
	KeyPEM string `json:"key"`
	Tags []string `json:"tags,omitempty"`
}