Skip to content

Commit

Permalink
add policy auto load
Browse files Browse the repository at this point in the history
  • Loading branch information
czyt committed Mar 1, 2023
1 parent 8b09ad8 commit 51c1ff1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ func Server(opts ...Option) middleware.Middleware {
})
o.enforcer.SetWatcher(o.watcher)
}
// add policy autoload
if o.autoLoadPolicy && o.enforcer != nil {
if !o.enforcer.IsAutoLoadingRunning() {
o.enforcer.StartAutoLoadPolicy(o.autoLoadPolicyInterval)
}
}
return func(handler middleware.Handler) middleware.Handler {
return func(ctx context.Context, req interface{}) (interface{}, error) {
var (
Expand Down

0 comments on commit 51c1ff1

Please sign in to comment.