from pydantic_settings import BaseSettings
from functools import lru_cache
 
class Settings(BaseSettings):
    DATABASE_URL: str
    DATABASE_URL_SYNC: str
    DEBUG: bool = False
    ALLOWED_ORIGINS: list[str] = []
    # Optional pattern for extra origins, e.g. phones reaching the app by the computer's network address
    ALLOWED_ORIGIN_REGEX: str | None = None
    APP_NAME:str='Astute Bridge'
    SECRET_KEY: str
    ALGORITHM: str = 'HS256'
    ACCESS_TOKEN_EXPIRE_MINUTES: int = 43200
    REFRESH_TOKEN_EXPIRE_DAYS: int = 30

 
    class Config:
        import os
        env_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '.env')
        env_file_encoding = 'utf-8'
 
@lru_cache()
def get_settings() -> Settings:
    return Settings()
 
settings = get_settings()
