Coverage for backend / app / main.py: 100%
16 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-05-02 15:51 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-05-02 15:51 +0000
1from fastapi import FastAPI
2from redis.asyncio import Redis
4from app.config import get_settings
5from app.utils.github_client import GithubClient
6from app.utils.aws_storage import AWSStorage
7from app.routers.coverage import router as cov_upload_router
8from app.routers.badge import router as badge_router
11async def lifespan(_: FastAPI):
12 settings = get_settings()
13 redis_connection = Redis.from_url(str(settings.redis_url))
14 async with (
15 AWSStorage(
16 access_key_id=settings.aws_access_key_id,
17 secret_access_key=settings.aws_secret_access_key,
18 bucket=settings.aws_bucket,
19 region=settings.aws_region,
20 upload_role_arn=settings.aws_upload_role_arn,
21 ) as aws_storage_client,
22 GithubClient(
23 token=settings.github_token,
24 ) as gh_client,
25 ):
26 yield {
27 "aws_storage_client": aws_storage_client,
28 "gh_client": gh_client,
29 "redis_connection": redis_connection,
30 }
31 await redis_connection.aclose()
34app = FastAPI(lifespan=lifespan, openapi_url=None)
37app.include_router(cov_upload_router, prefix="/coverage")
39app.include_router(badge_router, prefix="/badge")