load cert on startup
This commit is contained in:
parent
74723aa99a
commit
c2656deb28
1 changed files with 7 additions and 1 deletions
|
@ -66,6 +66,12 @@ func (cm *CertManager) Ready() bool {
|
||||||
func (cm *CertManager) Watch(ctx context.Context, log *zap.Logger) error {
|
func (cm *CertManager) Watch(ctx context.Context, log *zap.Logger) error {
|
||||||
cm.Log = log
|
cm.Log = log
|
||||||
|
|
||||||
|
if err := cm.Load(); err != nil {
|
||||||
|
log.Error("failed to load initial certificate", zap.Error(err))
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-time.After(time.Hour):
|
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 {
|
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
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue