feat(audit): 添加全局无侵入审计日志拦截器
This commit is contained in:
@ -20,6 +20,17 @@ def create_app():
|
||||
# 允许所有 /api/ 开头的请求跨域,支持 credentials
|
||||
cors.init_app(app, resources={r"/*": {"origins": "*"}}, supports_credentials=True)
|
||||
|
||||
# =========================================================
|
||||
# 1.1 注册全局审计日志监听器
|
||||
# =========================================================
|
||||
with app.app_context():
|
||||
try:
|
||||
from app.utils.audit_events import register_audit_events
|
||||
register_audit_events(db)
|
||||
print("✅ 审计事件监听器注册成功")
|
||||
except Exception as e:
|
||||
print(f"⚠️ 审计事件监听器注册失败: {e}")
|
||||
|
||||
# =========================================================
|
||||
# 2. 注册蓝图 (Blueprints)
|
||||
# ---------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user