初始化提交
This commit is contained in:
commit
887c1f449e
963 files changed
+166869
No files matched your search
@@ -0,0 +1,27 @@
|
||||
"""数据库配置:SQLite / PostgreSQL 连接参数。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Literal
|
||||
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
|
||||
class DatabaseConfig(BaseSettings):
|
||||
"""数据库配置。
|
||||
|
||||
本地开发默认使用 SQLite(``aiosqlite``);正式环境通过 ``DATABASE_TYPE=pgsql``
|
||||
切换到 PostgreSQL(``asyncpg``)。``DATABASE_URL`` 优先级最高,可直接覆盖。
|
||||
"""
|
||||
|
||||
database_type: Literal["sqlite", "pgsql"] = "sqlite" # 数据库类型
|
||||
sqlite_database_path: str = "../db/hunjing.sqlite3" # SQLite 数据库路径(相对 backend)
|
||||
database_url: str = "" # 自定义数据库连接 URL(优先级最高)
|
||||
postgres_host: str = "127.0.0.1" # PostgreSQL 主机
|
||||
postgres_port: int = 5432 # PostgreSQL 端口
|
||||
postgres_db: str = "hunjing" # PostgreSQL 数据库名
|
||||
postgres_user: str = "hunjing" # PostgreSQL 用户名
|
||||
postgres_password: str = "change-me" # PostgreSQL 密码
|
||||
postgres_ssl: bool = False # 是否启用 SSL
|
||||
postgres_pool_size: int = 10 # 连接池大小
|
||||
postgres_max_overflow: int = 20 # 连接池最大溢出连接数
|
||||
Reference in new issue
Block a user