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.
65 lines
1.6 KiB
65 lines
1.6 KiB
"""
|
|
AmazingData 数据服务平台 - 配置管理
|
|
"""
|
|
|
|
from pydantic_settings import BaseSettings
|
|
from typing import Optional
|
|
import os
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""应用配置"""
|
|
|
|
# 应用配置
|
|
APP_NAME: str = "AmazingData Platform"
|
|
APP_ENV: str = "development"
|
|
DEBUG: bool = True
|
|
SECRET_KEY: str = "your-secret-key-change-in-production"
|
|
|
|
# 数据库配置
|
|
DB_HOST: str = "localhost"
|
|
DB_PORT: int = 3306
|
|
DB_USER: str = "root"
|
|
DB_PASSWORD: str = "root123"
|
|
DB_NAME: str = "amazingdata_platform"
|
|
|
|
# AmazingData SDK 配置
|
|
AMAZING_DATA_USERNAME: str = "11200008169"
|
|
AMAZING_DATA_PASSWORD: str = "11200008169@2026"
|
|
AMAZING_DATA_HOST: str = "140.206.44.234"
|
|
AMAZING_DATA_PORT: int = 8600
|
|
|
|
# 服务配置
|
|
BACKEND_HOST: str = "0.0.0.0"
|
|
BACKEND_PORT: int = 8000
|
|
FRONTEND_PORT: int = 3000
|
|
|
|
# 数据配置
|
|
DATA_SAVE_PATH: str = "./data"
|
|
REALTIME_SAVE_DAYS: int = 7
|
|
CACHE_AUTO_SAVE_INTERVAL: int = 60
|
|
MAX_CONCURRENT_TASKS: int = 5
|
|
|
|
# JWT 配置
|
|
JWT_SECRET_KEY: str = "your-jwt-secret-key"
|
|
JWT_ALGORITHM: str = "HS256"
|
|
JWT_EXPIRE_MINUTES: int = 1440
|
|
|
|
@property
|
|
def DATABASE_URL(self) -> str:
|
|
"""获取数据库连接 URL"""
|
|
return f"mysql+pymysql://{self.DB_USER}:{self.DB_PASSWORD}@{self.DB_HOST}:{self.DB_PORT}/{self.DB_NAME}?charset=utf8mb4"
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
env_file_encoding = "utf-8"
|
|
case_sensitive = True
|
|
|
|
|
|
# 创建全局配置实例
|
|
settings = Settings()
|
|
|
|
|
|
def get_settings() -> Settings:
|
|
"""获取配置(用于依赖注入)"""
|
|
return settings |