diff --git a/api/app_factory.py b/api/app_factory.py index cb53445d..70bc3611 100644 --- a/api/app_factory.py +++ b/api/app_factory.py @@ -99,11 +99,4 @@ async def handle_oauth_error(request: Request, exc: Exception): # For other errors, let them bubble up raise exc - # Add template globals - @app.middleware("http") - async def add_template_globals(request: Request, call_next): - request.state.google_tag_manager_id = os.getenv("GOOGLE_TAG_MANAGER_ID") - response = await call_next(request) - return response - return app diff --git a/api/routes/auth.py b/api/routes/auth.py index d8225885..40eee554 100644 --- a/api/routes/auth.py +++ b/api/routes/auth.py @@ -36,6 +36,7 @@ ) ) +templates.env.globals["google_tag_manager_id"] = os.getenv("GOOGLE_TAG_MANAGER_ID") # ---- Helpers ---- def _get_provider_client(request: Request, provider: str):