Spaces:
Runtime error
Runtime error
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| """Main entrypoint for the FastAPI application using Lifespan context.""" | |
| from contextlib import asynccontextmanager | |
| from fastapi import FastAPI | |
| from core.config_loader import load_config | |
| from routes import main, healthcheck | |
| async def lifespan(app: FastAPI): | |
| """Startup and shutdown lifecycle manager.""" | |
| config = load_config() | |
| print(f"β {config['app']['name']} starting up...") | |
| yield | |
| print("π Application shutting down...") | |
| config = load_config() | |
| app = FastAPI(title=config["app"]["name"], debug=config["app"]["debug"], lifespan=lifespan) | |
| app.include_router(main.router) | |
| app.include_router(healthcheck.router) | |