Skip to content

Commit

Permalink
fixes openziti/ziti#2086 reload on xweb identity updates
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewpmartinez committed Jun 24, 2024
1 parent ac6d684 commit 57cc135
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions instance_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"crypto/tls"
"errors"
"fmt"
"github.com/michaelquigley/pfxlog"
"github.com/openziti/identity"
"time"
)
Expand Down Expand Up @@ -130,6 +131,10 @@ func (config *InstanceConfig) Validate(registry Registry) error {
//validate default identity by loading
if defaultIdentity, err := identity.LoadIdentity(*config.defaultIdentityConfig); err == nil {
config.DefaultIdentity = defaultIdentity

if err := config.DefaultIdentity.WatchFiles(); err != nil {
pfxlog.Logger().Warnf("could not enable file watching on default identity: %w", err)

Check failure on line 136 in instance_config.go

View workflow job for this annotation

GitHub Actions / Build Linux

(*github.com/sirupsen/logrus.Entry).Warnf does not support error-wrapping directive %w

Check failure on line 136 in instance_config.go

View workflow job for this annotation

GitHub Actions / Build Mac OS

(*github.com/sirupsen/logrus.Entry).Warnf does not support error-wrapping directive %w

Check failure on line 136 in instance_config.go

View workflow job for this annotation

GitHub Actions / Build Windows

(*github.com/sirupsen/logrus.Entry).Warnf does not support error-wrapping directive %w
}
} else {
return fmt.Errorf("could not load default identity: %v", err)
}
Expand Down
5 changes: 5 additions & 0 deletions server_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package xweb

import (
"fmt"
"github.com/michaelquigley/pfxlog"
"github.com/openziti/identity"
"github.com/pkg/errors"
)
Expand Down Expand Up @@ -100,6 +101,10 @@ func (config *ServerConfig) Parse(configMap map[interface{}]interface{}, pathCon
if err != nil {
return fmt.Errorf("error loading identity: %v", err)
}

if err := config.DefaultIdentity.WatchFiles(); err != nil {
pfxlog.Logger().Warnf("could not enable file watching on bind point identity: %v", err)
}
} else {
return fmt.Errorf("error parsing identity section: %v", err)
}
Expand Down

0 comments on commit 57cc135

Please sign in to comment.