Complete implementation of the production line incident response system (生產線異常即時反應系統) including: Backend (FastAPI): - User authentication with AD integration and session management - Chat room management (create, list, update, members, roles) - Real-time messaging via WebSocket (typing indicators, reactions) - File storage with MinIO (upload, download, image preview) Frontend (React + Vite): - Authentication flow with token management - Room list with filtering, search, and pagination - Real-time chat interface with WebSocket - File upload with drag-and-drop and image preview - Member management and room settings - Breadcrumb navigation - 53 unit tests (Vitest) Specifications: - authentication: AD auth, sessions, JWT tokens - chat-room: rooms, members, templates - realtime-messaging: WebSocket, messages, reactions - file-storage: MinIO integration, file management - frontend-core: React SPA structure 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
44 lines
962 B
Python
44 lines
962 B
Python
"""Application configuration loaded from environment variables"""
|
|
from pydantic_settings import BaseSettings
|
|
from functools import lru_cache
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""Application settings"""
|
|
|
|
# Database
|
|
DATABASE_URL: str
|
|
|
|
# Security
|
|
FERNET_KEY: str
|
|
|
|
# AD API
|
|
AD_API_URL: str
|
|
|
|
# Session Settings
|
|
SESSION_INACTIVITY_DAYS: int = 3
|
|
TOKEN_REFRESH_THRESHOLD_MINUTES: int = 5
|
|
MAX_REFRESH_ATTEMPTS: int = 3
|
|
|
|
# Server
|
|
HOST: str = "0.0.0.0"
|
|
PORT: int = 8000
|
|
DEBUG: bool = True
|
|
|
|
# MinIO Object Storage
|
|
MINIO_ENDPOINT: str = "localhost:9000"
|
|
MINIO_ACCESS_KEY: str = "minioadmin"
|
|
MINIO_SECRET_KEY: str = "minioadmin"
|
|
MINIO_BUCKET: str = "task-reporter-files"
|
|
MINIO_SECURE: bool = False # Use HTTPS
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
case_sensitive = True
|
|
|
|
|
|
@lru_cache()
|
|
def get_settings() -> Settings:
|
|
"""Get cached settings instance"""
|
|
return Settings()
|