Files
school_compare/backend/config.py

39 lines
867 B
Python
Raw Normal View History

2026-01-06 16:30:32 +00:00
"""
Application configuration using pydantic-settings.
Loads from environment variables and .env file.
"""
from pathlib import Path
from typing import List
from pydantic_settings import BaseSettings
import os
class Settings(BaseSettings):
"""Application settings loaded from environment."""
# Paths
data_dir: Path = Path(__file__).parent.parent / "data"
frontend_dir: Path = Path(__file__).parent.parent / "frontend"
# Server
host: str = "0.0.0.0"
port: int = 80
# CORS
allowed_origins: List[str] = ["https://schoolcompare.co.uk", "http://localhost:8000", "http://localhost:3000"]
# API
default_page_size: int = 50
max_page_size: int = 100
class Config:
env_file = ".env"
env_file_encoding = "utf-8"
extra = "ignore"
# Singleton instance
settings = Settings()