2024-11-28 02:25:50 +09:00
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
from typing import TypedDict
|
|
|
|
|
|
2024-12-23 05:15:22 +09:00
|
|
|
from eloquent import DatabaseManager, Model
|
2024-12-22 19:35:29 +09:00
|
|
|
|
2024-11-28 02:25:50 +09:00
|
|
|
CONFIG: dict[str, DbConfig] = { 'mysql': { 'driver': 'mysql',
|
|
|
|
|
'host': 'localhost',
|
|
|
|
|
'database': 'nizika_ai',
|
|
|
|
|
'user': os.environ['MYSQL_USER'],
|
|
|
|
|
'password': os.environ['MYSQL_PASS'],
|
|
|
|
|
'prefix': '' } }
|
|
|
|
|
|
2024-12-22 19:35:29 +09:00
|
|
|
DB = DatabaseManager (CONFIG)
|
|
|
|
|
Model.set_connection_resolver (DB)
|
|
|
|
|
|
2024-11-28 02:25:50 +09:00
|
|
|
|
|
|
|
|
class DbConfig (TypedDict):
|
|
|
|
|
driver: str
|
|
|
|
|
host: str
|
|
|
|
|
database: str
|
|
|
|
|
user: str
|
|
|
|
|
password: str
|
|
|
|
|
prefix: str
|