26 行
783 B
Python
26 行
783 B
Python
from __future__ import annotations
|
|
|
|
import os
|
|
from typing import TypedDict
|
|
|
|
from eloquent import DatabaseManager, Model # type: ignore
|
|
|
|
CONFIG: dict[str, DbConfig] = { 'mysql': { 'driver': 'mysql',
|
|
'host': 'localhost',
|
|
'database': 'nizika_ai',
|
|
'user': os.environ['MYSQL_USER'],
|
|
'password': os.environ['MYSQL_PASS'],
|
|
'prefix': '' } }
|
|
|
|
DB = DatabaseManager (CONFIG)
|
|
Model.set_connection_resolver (DB)
|
|
|
|
|
|
class DbConfig (TypedDict):
|
|
driver: str
|
|
host: str
|
|
database: str
|
|
user: str
|
|
password: str
|
|
prefix: str
|