feat: implement proxy management endpoints and MongoDB integration

This commit is contained in:
gabdevele
2026-04-12 00:55:29 +02:00 Unverified
parent 1b03ac7541
commit b4a84e70a2
6 changed files with 209 additions and 25 deletions
+20 -2
View File
@@ -1,9 +1,27 @@
from contextlib import asynccontextmanager
from fastapi import FastAPI
from api.proxy import router as proxy_router
from api.proxy.router import router as proxy_router
from core.mongodb import close_mongodb, init_mongodb
from core.redis import close_redis, init_redis
from utils.proxy.manager import ensure_proxy_indexes
@asynccontextmanager
async def lifespan(_: FastAPI):
await init_mongodb()
await init_redis()
await ensure_proxy_indexes()
try:
yield
finally:
await close_redis()
await close_mongodb()
app = FastAPI(
title="thePlugAPI"
title="thePlugAPI",
lifespan=lifespan,
)
app.include_router(proxy_router)