chore(release): 1.0.4 [skip ci]

## [1.0.4](https://github.com/node-casbin/redis-adapter/compare/v1.0.3...v1.0.4) (2023-05-18)

### Bug Fixes

* fix CI ([15e9f7c](https://github.com/node-casbin/redis-adapter/commit/15e9f7c137883fba99dbd5960a0b119e9d76b0ec))
* Pass redisOpts argument to constructor ([#12](https://github.com/node-casbin/redis-adapter/issues/12)) ([c9b4569](https://github.com/node-casbin/redis-adapter/commit/c9b45693f634313b8d7c17887185f4a29901c8b5))
2 files changed
tree: 6d47ef0315cc12fcdd0a477fe588eb3920e4fb49
  1. .github/
  2. examples/
  3. src/
  4. test/
  5. .gitignore
  6. .releaserc.json
  7. CHANGELOG.md
  8. jest.config.js
  9. LICENSE
  10. package.json
  11. README.md
  12. tsconfig.cjs.json
  13. tsconfig.esm.json
  14. tsconfig.json
  15. yarn.lock
README.md

casbin-redis-adapter

NPM version NPM download CI Coverage Status Gitter

Redis policy storage, implemented as an adapter for node-casbin.

Installation

npm install --save casbin-redis-adapter
// or
yarn add casbin-redis-adapter

Usage

Require it in a place, where you are instantiating an enforcer (read more about enforcer here):


import {newEnforcer} from 'casbin'; import {NodeRedisAdapter} from './adapter' ; import {join} from 'path'; const model = join(__dirname, 'casbin_conf/model.conf'); const adapter = await NodeRedisAdapter.newAdapter({host: "127.0.0.1", port: 6379}); const enforcer = await newEnforcer(model, adapter);

That is all what required for integrating the adapter into casbin.

Configuration

NodeRedisAdapter.newAdapter() takes the following parameters as an object to establish the connection with redis-server

options: interface IConnectionOptions {
    host: string // IP address of the Redis server
    port: number //	Port of the Redis server
}

redisOpts ? : redis.ClientOpts //https://github.com/NodeRedis/node-redis#options-object-properties

License

Apache-2.0