chore(deps): bump path-parse from 1.0.6 to 1.0.7 Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7. - [Release notes](https://github.com/jbgutierrez/path-parse/releases) - [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7) --- updated-dependencies: - dependency-name: path-parse dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com>
Redis watcher for node-casbin based on ioredis.
# NPM npm install --save @casbin/redis-watcher # Yarn yarn add @casbin/redis-watcher
Note: redis-watcher has been deprecated on NPM.
Using Redis:
import { RedisWatcher } from '@casbin/redis-watcher'; import { newEnforcer } from 'casbin'; // Initialize the watcher, see https://github.com/luin/ioredis/blob/master/API.md#new-redisport-host-options const watcher = await RedisWatcher.newWatcher('redis://localhost:6379/5'); // Initialize the enforcer. const enforcer = await newEnforcer('examples/authz_model.conf', 'examples/authz_policy.csv'); enforcer.setWatcher(watcher);
Using Redis cluster:
import { RedisWatcher } from '@casbin/redis-watcher'; import { newEnforcer } from 'casbin'; // Initialize the watcher, see https://github.com/luin/ioredis/blob/master/API.md#new-clusterstartupnodes-options. const watcher = await RedisWatcher.newWatcherWithCluster([{ port: 7000, host: 'localhost' }]); // Initialize the enforcer. const enforcer = await newEnforcer('examples/authz_model.conf', 'examples/authz_policy.csv'); enforcer.setWatcher(watcher);