import os from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from app.core.config import CORS_ALLOW_ORIGINS from app.api import health, auth, vehicles, notifications, parking, events, payments, predict, gate, profile, admin app = FastAPI(title="Ain El Aql API", version="2.0.0") app.add_middleware( CORSMiddleware, allow_origins=CORS_ALLOW_ORIGINS or ["*"], allow_credentials=False, allow_methods=["*"], allow_headers=["*"], ) app.include_router(health.router) app.include_router(auth.router) app.include_router(vehicles.router) app.include_router(notifications.router) app.include_router(parking.router) app.include_router(events.router) app.include_router(payments.router) app.include_router(predict.router) app.include_router(gate.router) app.include_router(profile.router) app.include_router(admin.router) @app.get("/") def root(): from app.core.config import MODEL_INFERENCE_PROVIDER, supabase_configured return { "status": "ok", "service": "ain-el-aql", "model_inference_provider": MODEL_INFERENCE_PROVIDER, "supabase_configured": supabase_configured(), "docs_url": "/docs", "health_url": "/health", } if __name__ == "__main__": import uvicorn uvicorn.run( "app.main:app", host=os.getenv("API_HOST", "0.0.0.0"), port=int(os.getenv("PORT", os.getenv("API_PORT", "8000"))), reload=False, )