from pathlib import Path from pydantic_settings import BaseSettings ROOT = Path(__file__).resolve().parents[2] class Settings(BaseSettings): database_url: str = f"sqlite:///{ROOT / 'backend' / 'data' / 'app.db'}" jwt_secret: str = "score-query-dev-secret-change-in-prod" jwt_algorithm: str = "HS256" jwt_expire_hours: int = 24 login_max_failures: int = 5 login_lock_minutes: int = 15 # 逗号分隔;可通过环境变量 CORS_ORIGINS 覆盖 cors_origins: str = ( "http://localhost:5174," "http://127.0.0.1:5174," "http://localhost:5175," "http://127.0.0.1:5175," "http://grader.gps120.com," "https://grader.gps120.com" ) settings = Settings()