config: add support for policies stored in the databroker (#1099)

* wip

* always use databroker config source

* add test

* valid policy, remove debug lines
This commit is contained in:
Caleb Doxsey 2020-07-17 10:35:29 -06:00 committed by GitHub
parent 821f2e9000
commit b79e73b8b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 965 additions and 6 deletions

View file

@ -45,7 +45,8 @@ func New(src config.Source) (*Manager, error) {
return
}
mgr.Trigger(mgr.GetConfig())
cfg = mgr.GetConfig()
mgr.Trigger(cfg)
})
return mgr, nil
}
@ -112,6 +113,7 @@ func (mgr *Manager) updateAutocert(cfg *config.Config) error {
cert, err = cm.CacheManagedCertificate(domain)
}
if err == nil {
log.Info().Strs("names", cert.Names).Msg("autocert: added certificate")
cfg.Options.Certificates = append(cfg.Options.Certificates, cert.Certificate)
} else {
log.Error().Err(err).Msg("autocert: failed to obtain client certificate")