summaryrefslogtreecommitdiff
path: root/modules/caddytls/fileloader.go
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-06-24 12:16:10 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2019-06-24 12:16:10 -0600
commit38677aaa58eb76a416fa42146956f3e3a5981e75 (patch)
treea782a862b7e552d1bdaeebf3514b75392a06f4b4 /modules/caddytls/fileloader.go
parentd49f762f6d9cdc2e92e8de40f0b0e99a9d0c4fc9 (diff)
caddytls: Support tags for manually-loaded certificates
Diffstat (limited to 'modules/caddytls/fileloader.go')
-rw-r--r--modules/caddytls/fileloader.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/modules/caddytls/fileloader.go b/modules/caddytls/fileloader.go
index 63592f9..d8e2d21 100644
--- a/modules/caddytls/fileloader.go
+++ b/modules/caddytls/fileloader.go
@@ -21,14 +21,15 @@ type fileLoader []CertKeyFilePair
// CertKeyFilePair pairs certificate and key file names along with their
// encoding format so that they can be loaded from disk.
type CertKeyFilePair struct {
- Certificate string `json:"certificate"`
- Key string `json:"key"`
- Format string `json:"format,omitempty"` // "pem" is default
+ Certificate string `json:"certificate"`
+ Key string `json:"key"`
+ Format string `json:"format,omitempty"` // "pem" is default
+ Tags []string `json:"tags,omitempty"`
}
// LoadCertificates returns the certificates to be loaded by fl.
-func (fl fileLoader) LoadCertificates() ([]tls.Certificate, error) {
- var certs []tls.Certificate
+func (fl fileLoader) LoadCertificates() ([]Certificate, error) {
+ var certs []Certificate
for _, pair := range fl {
certData, err := ioutil.ReadFile(pair.Certificate)
if err != nil {
@@ -52,7 +53,7 @@ func (fl fileLoader) LoadCertificates() ([]tls.Certificate, error) {
return nil, err
}
- certs = append(certs, cert)
+ certs = append(certs, Certificate{Certificate: cert, Tags: pair.Tags})
}
return certs, nil
}