Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion backend/api/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def _normalize_postgres_url(url: str) -> str:

def get_engine_url() -> str:
"""Resolve the database URL from env or settings with sane defaults."""
# Use the cached settings instance instead of instantiating ``Settings``
# directly so configuration is read a single time across the app.
settings = get_settings()
url = os.getenv("DATABASE_URL", settings.database_url)
if url.startswith("sqlite"):
Expand Down Expand Up @@ -56,4 +58,4 @@ def get_db() -> Generator:
try:
yield db
finally:
db.close()
db.close()
Loading