feat: add Redis support and update service/proxy models
Build and Push to Registry / build (push) Successful in 13s

This commit is contained in:
gabdevele
2026-04-12 00:16:46 +02:00 Unverified
parent f6351805ba
commit b5c854a243
7 changed files with 47 additions and 1 deletions
+22
View File
@@ -0,0 +1,22 @@
from motor.motor_asyncio import AsyncIOMotorClient, AsyncIOMotorDatabase
from core.config import settings
class _MongoDB:
client: AsyncIOMotorClient | None = None
def get_database(self) -> AsyncIOMotorDatabase:
if self.client is None:
raise RuntimeError("MongoDB client has not been initialized")
return self.client[settings.MONGODB_DB_NAME]
mongodb = _MongoDB()
async def get_database() -> AsyncIOMotorDatabase:
return mongodb.get_database()
async def ensure_mongodb_available() -> None:
client = mongodb.client
if client is None:
raise RuntimeError("MongoDB client has not been initialized")
await client.admin.command("ping")