+
+func (c Config) GetTLSConfig() (*tls.Config, error) {
+ certs := make([]tls.Certificate, 0, len(c.Servers))
+ for _, server := range c.Servers {
+ if server.TLSCertPath == "" {
+ continue
+ }
+
+ cert, err := tls.LoadX509KeyPair(server.TLSCertPath, server.TLSKeyPath)
+ if err != nil {
+ return nil, err
+ }
+ certs = append(certs, cert)
+ }
+
+ if len(certs) == 0 {
+ return nil, nil
+ }
+
+ config := &tls.Config{
+ Certificates: certs,
+ }
+ config.BuildNameToCertificate()
+ return config, nil
+}