mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-25 20:49:30 +02:00
autocert: use atomic pointer to allow nil (#3817)
autocert: use atomic pointer to allow nil (#3816) Co-authored-by: Caleb Doxsey <cdoxsey@pomerium.com>
This commit is contained in:
parent
8924c47392
commit
f68ea66006
1 changed files with 3 additions and 3 deletions
|
@ -11,6 +11,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"sort"
|
"sort"
|
||||||
"sync"
|
"sync"
|
||||||
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/caddyserver/certmagic"
|
"github.com/caddyserver/certmagic"
|
||||||
|
@ -19,7 +20,6 @@ import (
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
"github.com/pomerium/pomerium/config"
|
"github.com/pomerium/pomerium/config"
|
||||||
"github.com/pomerium/pomerium/internal/atomicutil"
|
|
||||||
"github.com/pomerium/pomerium/internal/httputil"
|
"github.com/pomerium/pomerium/internal/httputil"
|
||||||
"github.com/pomerium/pomerium/internal/log"
|
"github.com/pomerium/pomerium/internal/log"
|
||||||
"github.com/pomerium/pomerium/internal/telemetry/metrics"
|
"github.com/pomerium/pomerium/internal/telemetry/metrics"
|
||||||
|
@ -48,7 +48,7 @@ type Manager struct {
|
||||||
mu sync.RWMutex
|
mu sync.RWMutex
|
||||||
config *config.Config
|
config *config.Config
|
||||||
certmagic *certmagic.Config
|
certmagic *certmagic.Config
|
||||||
acmeMgr *atomicutil.Value[*certmagic.ACMEIssuer]
|
acmeMgr atomic.Pointer[certmagic.ACMEIssuer]
|
||||||
srv *http.Server
|
srv *http.Server
|
||||||
acmeTLSALPNListener net.Listener
|
acmeTLSALPNListener net.Listener
|
||||||
|
|
||||||
|
@ -90,7 +90,6 @@ func newManager(ctx context.Context,
|
||||||
mgr := &Manager{
|
mgr := &Manager{
|
||||||
src: src,
|
src: src,
|
||||||
acmeTemplate: acmeTemplate,
|
acmeTemplate: acmeTemplate,
|
||||||
acmeMgr: atomicutil.NewValue(new(certmagic.ACMEIssuer)),
|
|
||||||
certmagic: certmagicConfig,
|
certmagic: certmagicConfig,
|
||||||
ocspCache: ocspRespCache,
|
ocspCache: ocspRespCache,
|
||||||
}
|
}
|
||||||
|
@ -265,6 +264,7 @@ func (mgr *Manager) renewCert(ctx context.Context, domain string, cert certmagic
|
||||||
|
|
||||||
func (mgr *Manager) updateAutocert(ctx context.Context, cfg *config.Config) error {
|
func (mgr *Manager) updateAutocert(ctx context.Context, cfg *config.Config) error {
|
||||||
if !cfg.Options.AutocertOptions.Enable {
|
if !cfg.Options.AutocertOptions.Enable {
|
||||||
|
mgr.acmeMgr.Store(nil)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue