add docker support

This commit is contained in:
David Rodenkirchen
2026-05-27 14:10:46 +02:00
parent a29028cb45
commit d6e8534f5b
6 changed files with 80 additions and 8 deletions
+4 -1
View File
@@ -66,8 +66,11 @@ class ConfigurationService:
def get_database_configuration(self) -> DatabaseConfiguration:
try:
return DatabaseConfiguration(
database_address=self._config["database"]["database_address"],
database_host=self._config["database"]["database_host"],
database_port=self._config["database"]["database_port"],
database_name=self._config["database"]["database_name"],
database_user=self._config["database"]["database_user"],
database_password=self._config["database"]["database_password"],
)
except KeyError:
logger.fatal("Error loading DatabaseConfiguration, exiting...")
+15 -5
View File
@@ -24,14 +24,24 @@ class DatabaseService:
self._db_config = db_config
self._client = None
self._database = None
self._users = None
async def initialize(self) -> None:
mongo_uri = f"mongodb://{self._db_config.database_user}:{self._db_config.database_password}@{self._db_config.database_host}:{self._db_config.database_port}/{self._db_config.database_name}?authSource=admin"
if self._client is None:
self._client = AsyncMongoClient(self._db_config.database_address)
self._database = self._client[self._db_config.database_name]
self._users: AsyncCollection = self._database["users"]
self._client = AsyncMongoClient(mongo_uri)
self._database = self._client[
self._db_config.database_name
]
await init_beanie(
database=self._database,
document_models=[User, Transaction, Ticket, Seat, CateringTypes.CateringMenuItem, CateringTypes.CateringOrder]
document_models=[
User,
Transaction,
Ticket,
Seat,
CateringTypes.CateringMenuItem,
CateringTypes.CateringOrder
]
)
+4 -1
View File
@@ -16,8 +16,11 @@ class MailingServiceConfiguration:
@dataclass(frozen=True)
class DatabaseConfiguration:
database_address: str
database_host: str
database_port: str
database_name: str
database_user: str
database_password :str
@dataclass(frozen=True)
class LanInfo: