import logging from contextlib import asynccontextmanager from fastapi import FastAPI from app.core.config import settings from app.routers import health, objects, migrate from app.services.backend_manager import initialize_backend logging.basicConfig( level=logging.INFO, format="%(asctime)s [%(levelname)s] %(name)s: %(message)s", ) logger = logging.getLogger(__name__) @asynccontextmanager async def lifespan(app: FastAPI): initialize_backend() logger.info("storage-service started (backend=%s)", settings.STORAGE_BACKEND) yield logger.info("storage-service shutting down") app = FastAPI(title="Storage Service", lifespan=lifespan) app.include_router(health.router) app.include_router(objects.router) app.include_router(migrate.router)