updated services api

This commit is contained in:
2025-05-30 23:43:46 +03:00
parent e5829f0525
commit f8184246d9
31 changed files with 2963 additions and 9 deletions

View File

@@ -0,0 +1,31 @@
import os
from pydantic_settings import BaseSettings, SettingsConfigDict
class Configs(BaseSettings):
"""
MongoDB configuration settings.
"""
# MongoDB connection settings
ENGINE: str = "mongodb"
USERNAME: str = "appuser" # Application user
PASSWORD: str = "apppassword" # Application password
HOST: str = "10.10.2.13"
PORT: int = 27017
DB: str = "appdb" # The application database
AUTH_DB: str = "appdb" # Authentication is done against admin database
@property
def url(self):
"""Generate the database URL.
mongodb://{MONGO_USERNAME}:{MONGO_PASSWORD}@{MONGO_HOST}:{MONGO_PORT}/{DB}?authSource={MONGO_AUTH_DB}
"""
# Include the database name in the URI
return f"{self.ENGINE}://{self.USERNAME}:{self.PASSWORD}@{self.HOST}:{self.PORT}/{self.DB}?authSource={self.DB}"
model_config = SettingsConfigDict(env_prefix="_MONGO_")
# Create a singleton instance of the MongoDB configuration settings
mongo_configs = Configs()