File size: 1,454 Bytes
34a66f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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,
    )