Skip to content

Commit 81683c8

Browse files
committed
Add optional issuerKey to Cache.RemoveManaged
1 parent 855d467 commit 81683c8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cache.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -395,16 +395,19 @@ func (certCache *Cache) AllMatchingCertificates(name string) []Certificate {
395395
}
396396

397397
// RemoveManaged removes managed certificates for the given subjects from the cache.
398-
// This effectively stops maintenance of those certificates.
399-
func (certCache *Cache) RemoveManaged(subjects []string) {
398+
// This effectively stops maintenance of those certificates. Optionally pass an issuer
399+
// key to remove only certs managed with a certain issuer.
400+
func (certCache *Cache) RemoveManaged(subjects []string, issuerKey string) {
400401
deleteQueue := make([]string, 0, len(subjects))
401402
for _, subject := range subjects {
402403
certs := certCache.getAllMatchingCerts(subject) // does NOT expand wildcards; exact matches only
403404
for _, cert := range certs {
404405
if !cert.managed {
405406
continue
406407
}
407-
deleteQueue = append(deleteQueue, cert.hash)
408+
if issuerKey == "" || cert.issuerKey == issuerKey {
409+
deleteQueue = append(deleteQueue, cert.hash)
410+
}
408411
}
409412
}
410413
certCache.Remove(deleteQueue)

0 commit comments

Comments
 (0)