Fix reload panic in Authorize code (#652)

This commit is contained in:
Travis Groth 2020-05-04 09:21:06 -04:00 committed by GitHub
parent 49604ed458
commit 6196278046
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -88,10 +88,14 @@ func newPolicyEvaluator(opts *config.Options) (evaluator.Evaluator, error) {
// UpdateOptions implements the OptionsUpdater interface and updates internal
// structures based on config.Options
func (a *Authorize) UpdateOptions(opts config.Options) error {
if a == nil {
return nil
}
log.Info().Str("checksum", fmt.Sprintf("%x", opts.Checksum())).Msg("authorize: updating options")
var err error
if a.pe, err = newPolicyEvaluator(&opts); err != nil {
pe, err := newPolicyEvaluator(&opts)
if err != nil {
return err
}
a.pe = pe
return nil
}