P0安全: SECRET_KEY/ADMIN_PASSWORD/CORS环境变量化, seed仅admin P1Mock: mock.ts 301->88行, 删8数据mock+5generateMock, net-1300行 P2组件: useToast/useFetchList+ConfirmDialog/FormDialog P3菜单: menuSections/menuItems->constants/menu.ts P4API: NotificationsPage/WorkflowPage重写+RolesPage演示 测试: 1050passed, tsc clean
27 lines
726 B
Python
27 lines
726 B
Python
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
from functools import lru_cache
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
ENV: str = "development"
|
|
DEBUG: bool = True
|
|
|
|
SECRET_KEY: str = "dev-secret-key-change-in-production"
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
|
|
ALGORITHM: str = "HS256"
|
|
|
|
DATABASE_URL: str = "sqlite+aiosqlite:///./sqlite3.db"
|
|
|
|
ADMIN_USERNAME: str = "admin"
|
|
ADMIN_PASSWORD: str = "123456"
|
|
|
|
# CORS: production comma-separated origins (e.g. "https://sql.example.com,https://sql2.example.com")
|
|
CORS_ORIGINS: str = ""
|
|
|
|
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8")
|
|
|
|
|
|
@lru_cache()
|
|
def get_settings() -> Settings:
|
|
return Settings()
|