from pydantic_settings import BaseSettings from typing import Optional import os import warnings class Settings(BaseSettings): """ Application settings loaded from environment variables. """ database_url: str = "" # Making optional with empty default better_auth_secret: str = "" better_auth_url: str = "http://localhost:3000" api_host: str = "0.0.0.0" api_port: int = 7860 debug: bool = False class Config: env_file = ".env" if os.path.exists(".env") else None env_file_encoding = 'utf-8' settings = Settings() # Check for missing critical settings if not settings.database_url: warnings.warn("DATABASE_URL is not set. The app may not function properly without a database connection.") if not settings.better_auth_secret: warnings.warn("BETTER_AUTH_SECRET is not set. Using default empty value. This is insecure for production.") if settings.better_auth_url == "": settings.better_auth_url = "http://localhost:3000" # Set default if empty