chore(release): 1.1.0 [skip ci]

# [1.1.0](https://github.com/pycasbin/async-postgres-watcher/compare/v1.0.0...v1.1.0) (2024-03-17)

### Features

* bump version to 1.1.0 ([8f2d142](https://github.com/pycasbin/async-postgres-watcher/commit/8f2d142de74faa88d1730b11c5eba0963774bffe))
1 file changed
tree: b3b955f095b166b447d9f82f12e024e355b6914b
  1. .github/
  2. async_postgres_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

async-postgres-watcher

tests PyPI - Version PyPI - Wheel PyPI - Downloads PyPI - License Discord

Async Casbin PostgreSQL watcher to be used for monitoring updates to Casbin policies.

Installation

pip install casbin-async-postgres-watcher

Basic Usage Example

With Flask-authz

from flask_authz import CasbinEnforcer
from async_postgres_watcher import AsyncPostgresWatcher
from flask import Flask
from casbin.persist.adapters import FileAdapter

casbin_enforcer = CasbinEnforcer(app, adapter)

watcher = AsyncPostgresWatcher(host=HOST, port=PORT, user=USER, password=PASSWORD, dbname=DBNAME)
watcher.set_update_callback(casbin_enforcer.e.load_policy)

casbin_enforcer.set_watcher(watcher)

Basic Usage Example With SSL Enabled

See asyncpg documentation for full details of SSL parameters.

With Flask-authz

from flask_authz import CasbinEnforcer
from async_postgres_watcher import AsyncPostgresWatcher
from flask import Flask
from casbin.persist.adapters import FileAdapter

casbin_enforcer = CasbinEnforcer(app, adapter)

# If check_hostname is True, the SSL context is created with sslmode=verify-full.
# If check_hostname is False, the SSL context is created with sslmode=verify-ca.
watcher = AsyncPostgresWatcher(host=HOST, port=PORT, user=USER, password=PASSWORD, dbname=DBNAME, sslrootcert=SSLROOTCERT, check_hostname = True, sslcert=SSLCERT, sslkey=SSLKEY)
watcher.set_update_callback(casbin_enforcer.e.load_policy)

casbin_enforcer.set_watcher(watcher)

Getting Help

License

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