Implemented CLEAN architecture with clear separation of concerns: - Domain layer with entities (Player, Team, Stats, FantasyTeam) and repository interfaces - Application layer with use case implementations - Infrastructure layer with NHL API and Yahoo Fantasy API adapters - Presentation layer with FastAPI configuration and dependency injection Key features: - Swappable data source adapters (NHL API, Yahoo Fantasy API) - Repository pattern for data access abstraction - Dependency injection for loose coupling - FastAPI framework with async support - PostgreSQL database configuration - Environment-based configuration management Technology stack: Python 3.11+, FastAPI, PostgreSQL, nhl-api-py, yfpy 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
34 lines
898 B
Python
34 lines
898 B
Python
"""Application configuration settings."""
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""Application settings loaded from environment variables."""
|
|
|
|
model_config = SettingsConfigDict(
|
|
env_file=".env",
|
|
env_file_encoding="utf-8",
|
|
case_sensitive=False,
|
|
)
|
|
|
|
# Application
|
|
app_name: str = "Project Kempe - Fantasy Hockey Backend"
|
|
app_version: str = "0.1.0"
|
|
debug: bool = False
|
|
|
|
# Database
|
|
database_url: str = "postgresql+asyncpg://user:password@localhost:5432/fantasy_hockey"
|
|
|
|
# Yahoo Fantasy API
|
|
yahoo_consumer_key: str = ""
|
|
yahoo_consumer_secret: str = ""
|
|
|
|
# API Configuration
|
|
api_prefix: str = "/api/v1"
|
|
cors_origins: list[str] = ["http://localhost:3000"]
|
|
|
|
|
|
def get_settings() -> Settings:
|
|
"""Returns the application settings singleton."""
|
|
return Settings()
|