summaryrefslogtreecommitdiff
path: root/modules/caddytls/tls.go
diff options
context:
space:
mode:
authorMatt Holt <mholt@users.noreply.github.com>2020-07-30 15:18:14 -0600
committerGitHub <noreply@github.com>2020-07-30 15:18:14 -0600
commit6a14e2c2a8881d5e90f1ee363ec4662a3f87402b (patch)
tree3d10bdfe62e709e70e16725659e860bee20ca8e6 /modules/caddytls/tls.go
parent2bc30bb780f3b93593a2a9e42db6ab215fe12902 (diff)
caddytls: Replace lego with acmez (#3621)
* Replace lego with acmez; upgrade CertMagic * Update integration test
Diffstat (limited to 'modules/caddytls/tls.go')
-rw-r--r--modules/caddytls/tls.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/modules/caddytls/tls.go b/modules/caddytls/tls.go
index b2d05be..8178026 100644
--- a/modules/caddytls/tls.go
+++ b/modules/caddytls/tls.go
@@ -87,6 +87,7 @@ func (t *TLS) Provision(ctx caddy.Context) error {
GetConfigForCert: func(cert certmagic.Certificate) (*certmagic.Config, error) {
return t.getConfigForName(cert.Names[0]), nil
},
+ Logger: t.logger.Named("cache"),
}
if t.Automation != nil {
cacheOpts.OCSPCheckInterval = time.Duration(t.Automation.OCSPCheckInterval)
@@ -95,6 +96,9 @@ func (t *TLS) Provision(ctx caddy.Context) error {
if t.Cache != nil {
cacheOpts.Capacity = t.Cache.Capacity
}
+ if cacheOpts.Capacity <= 0 {
+ cacheOpts.Capacity = 10000
+ }
t.certCache = certmagic.NewCache(cacheOpts)
// certificate loaders
@@ -172,6 +176,7 @@ func (t *TLS) Provision(ctx caddy.Context) error {
// commands like validate can be a better test
magic := certmagic.New(t.certCache, certmagic.Config{
Storage: ctx.Storage(),
+ Logger: t.logger,
})
for _, loader := range t.certificateLoaders {
certs, err := loader.LoadCertificates()
@@ -412,13 +417,13 @@ func (t *TLS) cleanStorageUnits() {
}
// start with the default storage
- certmagic.CleanStorage(t.ctx.Storage(), options)
+ certmagic.CleanStorage(t.ctx, t.ctx.Storage(), options)
// then clean each storage defined in ACME automation policies
if t.Automation != nil {
for _, ap := range t.Automation.Policies {
if ap.storage != nil {
- certmagic.CleanStorage(ap.storage, options)
+ certmagic.CleanStorage(t.ctx, ap.storage, options)
}
}
}