summaryrefslogtreecommitdiff
path: root/modules/caddytls/distributedstek
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2022-03-25 11:28:54 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2022-03-25 11:28:54 -0600
commitd06d0e79f839a26ab2cf81b00ba2d180623c57a9 (patch)
treec215c3c16ad9280df4721b53460bd36aa5893489 /modules/caddytls/distributedstek
parenta58f240d3ecbb59285303746406cab50217f8d24 (diff)
go.mod: Upgrade CertMagic to v0.16.0
Includes several breaking changes; code base updated accordingly. - Added lots of context arguments - Use fs.ErrNotExist - Rename ACMEManager -> ACMEIssuer; CertificateManager -> Manager
Diffstat (limited to 'modules/caddytls/distributedstek')
-rw-r--r--modules/caddytls/distributedstek/distributedstek.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/modules/caddytls/distributedstek/distributedstek.go b/modules/caddytls/distributedstek/distributedstek.go
index e76fc47..18ed694 100644
--- a/modules/caddytls/distributedstek/distributedstek.go
+++ b/modules/caddytls/distributedstek/distributedstek.go
@@ -26,7 +26,9 @@ import (
"bytes"
"encoding/gob"
"encoding/json"
+ "errors"
"fmt"
+ "io/fs"
"log"
"runtime/debug"
"time"
@@ -115,7 +117,7 @@ func (s *Provider) Next(doneChan <-chan struct{}) <-chan [][32]byte {
func (s *Provider) loadSTEK() (distributedSTEK, error) {
var sg distributedSTEK
- gobBytes, err := s.storage.Load(stekFileName)
+ gobBytes, err := s.storage.Load(s.ctx, stekFileName)
if err != nil {
return sg, err // don't wrap, in case error is certmagic.ErrNotExist
}
@@ -133,7 +135,7 @@ func (s *Provider) storeSTEK(dstek distributedSTEK) error {
if err != nil {
return fmt.Errorf("encoding STEK gob: %v", err)
}
- err = s.storage.Store(stekFileName, buf.Bytes())
+ err = s.storage.Store(s.ctx, stekFileName, buf.Bytes())
if err != nil {
return fmt.Errorf("storing STEK gob: %v", err)
}
@@ -151,11 +153,11 @@ func (s *Provider) getSTEK() (distributedSTEK, error) {
}
//nolint:errcheck
- defer s.storage.Unlock(stekLockName)
+ defer s.storage.Unlock(s.ctx, stekLockName)
// load the current STEKs from storage
dstek, err := s.loadSTEK()
- if _, isNotExist := err.(certmagic.ErrNotExist); isNotExist {
+ if errors.Is(err, fs.ErrNotExist) {
// if there is none, then make some right away
dstek, err = s.rotateKeys(dstek)
if err != nil {