load cert on startup

This commit is contained in:
Seán C McCord 2023-09-30 18:04:52 -04:00
parent 74723aa99a
commit c2656deb28
Signed by: scm
GPG key ID: FC678714ACA347CB

View file

@ -66,6 +66,12 @@ func (cm *CertManager) Ready() bool {
func (cm *CertManager) Watch(ctx context.Context, log *zap.Logger) error {
cm.Log = log
if err := cm.Load(); err != nil {
log.Error("failed to load initial certificate", zap.Error(err))
return err
}
for {
select {
case <-time.After(time.Hour):
@ -74,7 +80,7 @@ func (cm *CertManager) Watch(ctx context.Context, log *zap.Logger) error {
}
if err := cm.Load(); err != nil {
log.Error("failed to load new certificate", zap.Error(err))
log.Error("failed to reload new certificate", zap.Error(err))
continue
}