You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
113 lines
4.5 KiB
113 lines
4.5 KiB
import os
|
|
import typing
|
|
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
VERSION: str = "0.1.0"
|
|
APP_TITLE: str = "Vue FastAPI Admin"
|
|
PROJECT_NAME: str = "Vue FastAPI Admin"
|
|
APP_DESCRIPTION: str = "Description"
|
|
|
|
CORS_ORIGINS: typing.List = ["*"]
|
|
CORS_ALLOW_CREDENTIALS: bool = True
|
|
CORS_ALLOW_METHODS: typing.List = ["*"]
|
|
CORS_ALLOW_HEADERS: typing.List = ["*"]
|
|
|
|
DEBUG: bool = True
|
|
|
|
PROJECT_ROOT: str = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
|
|
BASE_DIR: str = os.path.abspath(os.path.join(PROJECT_ROOT, os.pardir))
|
|
LOGS_ROOT: str = os.path.join(BASE_DIR, "app/logs")
|
|
SECRET_KEY: str = "3488a63e1765035d386f05409663f55c83bfae3b3c61a932744b20ad14244dcf" # openssl rand -hex 32
|
|
JWT_ALGORITHM: str = "HS256"
|
|
JWT_ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 7 # 7 day
|
|
# DeepSeek
|
|
DEEPSEEK_API_KEY: str = "sk-377e35cd9b2241e0ac3cafb6e0da5e89"
|
|
DEEPSEEK_API_URL: str = "https://api.deepseek.com/v1"
|
|
# Redis
|
|
REDIS_HOST: str = "172.21.11.23"
|
|
REDIS_PORT: int = 16379
|
|
REDIS_DB: int = 3
|
|
REDIS_PASSWORD: str = "5578ac31278440dba14c22221b963394-c2814ceb07d04386b2bc4c16c2e5c63a"
|
|
# flow mysql
|
|
FLOW_MYSQL_HOST: str = "172.21.11.23"
|
|
FLOW_MYSQL_PORT: int = 13326
|
|
FLOW_MYSQL_USER: str = "root"
|
|
FLOW_MYSQL_PASSWORD: str = "#@$3cJ?*=&981+--.$%^bnoZT12QfK"
|
|
FLOW_MYSQL_DB: str = "equipment_passenger_flow"
|
|
# 验签秘钥
|
|
SIGN_KEY: str = "qIaGO0fZJNW2f0DM6upT"
|
|
TORTOISE_ORM: dict = {
|
|
"connections": {
|
|
# SQLite configuration
|
|
# "sqlite": {
|
|
# "engine": "tortoise.backends.sqlite",
|
|
# "credentials": {"file_path": f"{BASE_DIR}/db.sqlite3"}, # Path to SQLite database file
|
|
# },
|
|
# MySQL/MariaDB configuration
|
|
# Install with: tortoise-orm[asyncmy]
|
|
"mysql": {
|
|
"engine": "tortoise.backends.mysql",
|
|
"credentials": {
|
|
"host": "172.21.11.23",
|
|
"port": 13326,
|
|
"user": "root",
|
|
"password": "#@$3cJ?*=&981+--.$%^bnoZT12QfK",
|
|
"database": "bd_ai_fastapi",
|
|
},
|
|
"pool_size": 10, # 增加连接池大小
|
|
"max_overflow": 20, # 允许临时超过连接池大小的连接数
|
|
"pool_recycle": 100 # 连接回收时间(秒)
|
|
},
|
|
# PostgreSQL configuration
|
|
# Install with: tortoise-orm[asyncpg]
|
|
# "postgres": {
|
|
# "engine": "tortoise.backends.asyncpg",
|
|
# "credentials": {
|
|
# "host": "localhost", # Database host address
|
|
# "port": 5432, # Database port
|
|
# "user": "yourusername", # Database username
|
|
# "password": "yourpassword", # Database password
|
|
# "database": "yourdatabase", # Database name
|
|
# },
|
|
# },
|
|
# MSSQL/Oracle configuration
|
|
# Install with: tortoise-orm[asyncodbc]
|
|
# "oracle": {
|
|
# "engine": "tortoise.backends.asyncodbc",
|
|
# "credentials": {
|
|
# "host": "localhost", # Database host address
|
|
# "port": 1433, # Database port
|
|
# "user": "yourusername", # Database username
|
|
# "password": "yourpassword", # Database password
|
|
# "database": "yourdatabase", # Database name
|
|
# },
|
|
# },
|
|
# SQLServer configuration
|
|
# Install with: tortoise-orm[asyncodbc]
|
|
# "sqlserver": {
|
|
# "engine": "tortoise.backends.asyncodbc",
|
|
# "credentials": {
|
|
# "host": "localhost", # Database host address
|
|
# "port": 1433, # Database port
|
|
# "user": "yourusername", # Database username
|
|
# "password": "yourpassword", # Database password
|
|
# "database": "yourdatabase", # Database name
|
|
# },
|
|
# },
|
|
},
|
|
"apps": {
|
|
"models": {
|
|
"models": ["app.models", "aerich.models", "app.models.quick_question", "app.models.hot_question"],
|
|
"default_connection": "mysql",
|
|
},
|
|
},
|
|
"use_tz": False, # Whether to use timezone-aware datetimes
|
|
"timezone": "Asia/Shanghai", # Timezone setting
|
|
}
|
|
DATETIME_FORMAT: str = "%Y-%m-%d %H:%M:%S"
|
|
|
|
|
|
settings = Settings()
|
|
|