Files
school_compare/backend/config.py

42 lines
993 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
2026-01-06 17:15:43 +00:00
from typing import List, Optional
2026-01-06 16:30:32 +00:00
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
2026-01-06 17:15:43 +00:00
# Database
database_url: str = "postgresql://schoolcompare:schoolcompare@localhost:5432/schoolcompare"
2026-01-06 16:30:32 +00:00
# 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()