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: 4 additions & 0 deletions archipy/helpers/utils/app_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import logging
from collections.abc import Awaitable, Callable
from contextlib import AbstractAsyncContextManager
from http import HTTPStatus
from typing import Any, cast

Expand Down Expand Up @@ -229,12 +230,14 @@ def create_fastapi_app(
config: BaseConfig | None = None,
*,
configure_exception_handlers: bool = True,
lifespan: Callable[..., AbstractAsyncContextManager] | None = None,
) -> FastAPI:
"""Creates and configures a FastAPI application.

Args:
config (BaseConfig | None): Optional custom configuration. If not provided, uses global config.
configure_exception_handlers (bool): Whether to configure exception handlers.
lifespan: Callable[..., AbstractAsyncContextManager] | None = None,

Returns:
FastAPI: The configured FastAPI application instance.
Expand All @@ -253,6 +256,7 @@ def create_fastapi_app(
docs_url=config.FASTAPI.DOCS_URL,
redocs_url=config.FASTAPI.RE_DOCS_URL,
responses=cast(dict[int | str, Any], common_responses),
lifespan=lifespan,
)

FastAPIUtils.setup_sentry(config)
Expand Down