From 38677aaa58eb76a416fa42146956f3e3a5981e75 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Mon, 24 Jun 2019 12:16:10 -0600 Subject: caddytls: Support tags for manually-loaded certificates --- modules/caddytls/tls.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'modules/caddytls/tls.go') diff --git a/modules/caddytls/tls.go b/modules/caddytls/tls.go index 63bc21d..7f5b1e9 100644 --- a/modules/caddytls/tls.go +++ b/modules/caddytls/tls.go @@ -98,7 +98,7 @@ func (t *TLS) Start() error { Storage: t.ctx.Storage(), }) for _, cert := range certs { - err := magic.CacheUnmanagedTLSCertificate(cert) + err := magic.CacheUnmanagedTLSCertificate(cert.Certificate, cert.Tags) if err != nil { return fmt.Errorf("caching unmanaged certificate: %v", err) } @@ -182,8 +182,16 @@ func (t *TLS) getAutomationPolicyForName(name string) AutomationPolicy { } // CertificateLoader is a type that can load certificates. +// Certificates can optionally be associated with tags. type CertificateLoader interface { - LoadCertificates() ([]tls.Certificate, error) + LoadCertificates() ([]Certificate, error) +} + +// Certificate is a TLS certificate, optionally +// associated with arbitrary tags. +type Certificate struct { + tls.Certificate + Tags []string } // AutomationConfig designates configuration for the -- cgit v1.2.3