Skip to content

Commit b5bc7b5

Browse files
committed
only add middlewares if they will be used
1 parent 6e3a7b9 commit b5bc7b5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/fides/api/app_setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,10 @@ def create_fides_app(
120120
# Pure ASGI middleware for request logging, analytics, and audit logging
121121
# These are high-performance replacements for BaseHTTPMiddleware-based versions
122122
fastapi_app.add_middleware(LogRequestMiddleware)
123-
fastapi_app.add_middleware(AnalyticsLoggingMiddleware)
123+
124+
if not CONFIG.user.analytics_opt_out:
125+
fastapi_app.add_middleware(AnalyticsLoggingMiddleware)
126+
124127
if CONFIG.security.enable_audit_log_resource_middleware:
125128
fastapi_app.add_middleware(AuditLogMiddleware)
126129

0 commit comments

Comments
 (0)