Files
algorithm/backend/app/config/settings.py
2026-02-09 23:59:25 +08:00

57 lines
1.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from pydantic_settings import BaseSettings
from typing import Optional
class Settings(BaseSettings):
"""应用配置类"""
# 应用基本配置
APP_NAME: str = "智能算法展示平台"
APP_VERSION: str = "1.0.0"
DEBUG: bool = True
# 数据库配置
DATABASE_URL: str = "postgresql://admin:password@localhost:5432/algorithm_db"
# Redis配置
REDIS_URL: str = "redis://localhost:6379/0"
# MinIO配置
MINIO_ENDPOINT: str = "localhost:9000"
MINIO_ACCESS_KEY: str = "minioadmin"
MINIO_SECRET_KEY: str = "minioadmin"
MINIO_BUCKET_NAME: str = "algorithm-data"
MINIO_SECURE: bool = False
# JWT配置
SECRET_KEY: str = "your-secret-key-here"
ALGORITHM: str = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
# OpenAI配置
OPENAI_API_KEY: Optional[str] = None
OPENAI_MODEL: str = "gpt-3.5-turbo"
# CORS配置
CORS_ORIGINS: list = ["*"]
# API配置
API_V1_STR: str = "/api/v1"
# 部署配置
DEPLOYMENT_MODE: str = "local" # 部署模式docker 或 local
# Gitea 配置
GITEA_SERVER_URL: str = ""
GITEA_ACCESS_TOKEN: str = ""
GITEA_DEFAULT_OWNER: str = ""
GITEA_REPO_PREFIX: str = "AI"
class Config:
env_file = ".env"
case_sensitive = True
extra = "allow" # 允许额外的环境变量
# 创建全局配置实例
settings = Settings()