Moved code to subfolder

This commit is contained in:
2023-03-10 09:21:27 +01:00
parent 69416eb896
commit b90fbdf668
12 changed files with 24 additions and 0 deletions

View File

@@ -0,0 +1 @@
from .config import Settings

23
backend/config/config.py Normal file
View File

@@ -0,0 +1,23 @@
from beanie import init_beanie
from motor.motor_asyncio import AsyncIOMotorClient
from pydantic import BaseSettings
from typing import Literal
from models.request import Request
class Settings(BaseSettings):
DATABASE_URL: str
AZURE_KEY: str
AZURE_ENDPOINT: str
AZURE_LOCATION: str
ENV: Literal["dev", "prod"]
class Config:
env_file = ".env"
orm_mode = True
async def initiate_database():
client = AsyncIOMotorClient(Settings().DATABASE_URL)
await init_beanie(database=client.get_default_database(), document_models=[Request])