- Backend: FastAPI + Python-SocketIO + SQLAlchemy - Models for categories, questions, game sessions, events - AI services for answer validation and question generation (Claude) - Room management with Redis - Game logic with stealing mechanics - Admin API for question management - Frontend: React + Vite + TypeScript + Tailwind - 5 visual themes (DRRR, Retro, Minimal, RGB, Anime 90s) - Real-time game with Socket.IO - Achievement system - Replay functionality - Sound effects per theme - Docker Compose for deployment - Design documentation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
48 lines
978 B
Python
48 lines
978 B
Python
from pydantic_settings import BaseSettings
|
|
from functools import lru_cache
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
# Database
|
|
database_url: str = "postgresql://trivia:trivia@localhost:5432/trivia"
|
|
|
|
# Redis
|
|
redis_url: str = "redis://localhost:6379"
|
|
|
|
# JWT
|
|
jwt_secret: str = "dev-secret-key-change-in-production"
|
|
jwt_algorithm: str = "HS256"
|
|
jwt_expire_minutes: int = 1440 # 24 hours
|
|
|
|
# Anthropic
|
|
anthropic_api_key: str = ""
|
|
|
|
# Game settings
|
|
default_times: dict = {
|
|
1: 15, # 100 pts
|
|
2: 20, # 200 pts
|
|
3: 25, # 300 pts
|
|
4: 35, # 400 pts
|
|
5: 45, # 500 pts
|
|
}
|
|
|
|
default_points: dict = {
|
|
1: 100,
|
|
2: 200,
|
|
3: 300,
|
|
4: 400,
|
|
5: 500,
|
|
}
|
|
|
|
steal_penalty_multiplier: float = 0.5
|
|
steal_time_multiplier: float = 0.5
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
extra = "ignore"
|
|
|
|
|
|
@lru_cache()
|
|
def get_settings() -> Settings:
|
|
return Settings()
|