Skip to content

Commit

Permalink
Merge 175ecfd into 949454e
Browse files Browse the repository at this point in the history
  • Loading branch information
calebdoxsey committed Apr 25, 2023
2 parents 949454e + 175ecfd commit b0553c8
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions internal/autocert/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,31 @@ func newManager(ctx context.Context,
return nil, err
}

certmagicConfig := certmagic.NewDefault()
// set certmagic default storage cache, otherwise cert renewal loop will be based off
// certmagic's own default location
certmagicConfig.Storage, err = GetCertMagicStorage(ctx, src.GetConfig().Options.AutocertOptions.Folder)
if err != nil {
return nil, err
}

logger := log.ZapLogger().With(zap.String("service", "autocert"))
certmagicConfig.Logger = logger
acmeTemplate.Logger = logger

mgr := &Manager{
src: src,
acmeTemplate: acmeTemplate,
certmagic: certmagicConfig,
ocspCache: ocspRespCache,
}

// set certmagic default storage cache, otherwise cert renewal loop will be based off
// certmagic's own default location
certmagicStorage, err := GetCertMagicStorage(ctx, src.GetConfig().Options.AutocertOptions.Folder)
if err != nil {
return nil, err
}
mgr.certmagic = certmagic.New(certmagic.NewCache(certmagic.CacheOptions{
GetConfigForCert: func(c certmagic.Certificate) (*certmagic.Config, error) {
return mgr.certmagic, nil
},
Logger: logger,
}), certmagic.Config{
Logger: logger,
Storage: certmagicStorage,
})

err = mgr.update(ctx, src.GetConfig())
if err != nil {
return nil, err
Expand Down

0 comments on commit b0553c8

Please sign in to comment.