chore(release): 1.1.0 [skip ci]

# [1.1.0](https://github.com/pycasbin/etcd-watcher/compare/v1.0.2...v1.1.0) (2024-03-29)

### Features

* upgrade CI Node.js version to 20 ([b2cd269](https://github.com/pycasbin/etcd-watcher/commit/b2cd269b389b14285cc61417ff96a1e6914b4e8a))
2 files changed
tree: 8da9b3a522d9a56f79f3abfc1ab705e53c9456a4
  1. .github/
  2. etcd_watcher/
  3. examples/
  4. tests/
  5. .gitignore
  6. .releaserc.json
  7. CHANGELOG.md
  8. LICENSE
  9. package.json
  10. pyproject.toml
  11. README.md
  12. requirements.txt
README.md

etcd-watcher

tests Coverage Status Version PyPI - Wheel Pyversions Download Discord

Etcd Watcher is the Etcd watcher for pycasbin. With this library, Casbin can synchronize the policy with the database in multiple enforcer instances.

Installation

pip install casbin-etcd-watcher

Simple Example

import casbin
from etcd_watcher import new_watcher

def update_callback_func(event):
    ...

watcher = new_watcher(endpoints=["localhost", 2379], keyname="/casbin")
watcher.set_update_callback(update_callback_func)

e = casbin.Enforcer(
	get_examples("rbac_model.conf"), get_examples("rbac_policy.csv")
)

e.set_watcher(watcher)
# update_callback_func will be called
e.save_policy()

Getting Help

License

This project is under Apache 2.0 License. See the LICENSE file for the full license text.