fix: make logfire disabled by default

Initially started by
https://github.com/learnhouse/learnhouse/pull/496
This commit is contained in:
swve 2025-08-06 14:45:08 +02:00
parent b425cd2984
commit 05abc93017
4 changed files with 20 additions and 4 deletions

View file

@ -37,8 +37,13 @@ app.add_middleware(
allow_headers=["*"],
)
logfire.configure(console=False, service_name=learnhouse_config.site_name,)
logfire.instrument_fastapi(app)
# Only enable logfire if explicitly configured
if learnhouse_config.general_config.logfire_enabled:
logfire.configure(console=False, service_name=learnhouse_config.site_name,)
logfire.instrument_fastapi(app)
# Instrument database after logfire is configured
from src.core.events.database import engine
logfire.instrument_sqlalchemy(engine=engine)
# Gzip Middleware (will add brotli later)
app.add_middleware(GZipMiddleware, minimum_size=1000)