chore(release): 1.3.0 [skip ci] # [1.3.0](https://github.com/officialpycasbin/async-postgres-watcher/compare/v1.2.0...v1.3.0) (2025-08-15) ### Features * switch from casbin to pycasbin ([8bc75bc](https://github.com/officialpycasbin/async-postgres-watcher/commit/8bc75bcef722828804046447081a5bc88942157a))
Async Casbin PostgreSQL watcher to be used for monitoring updates to Casbin policies.
pip install casbin-async-postgres-watcher
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)
See asyncpg documentation for full details of SSL parameters.
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)
This project is under Apache 2.0 License. See the LICENSE file for the full license text.