26 lines
854 B
Python
26 lines
854 B
Python
from functools import lru_cache
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
database_url: str = "sqlite:///./metabloom.db"
|
|
jwt_secret: str = "change-me-in-production-at-least-32-characters"
|
|
jwt_algorithm: str = "HS256"
|
|
access_token_minutes: int = 30
|
|
allowed_origins: str = "http://localhost:8081,http://localhost:19006"
|
|
environment: str = "development"
|
|
ai_base_url: str = "http://localhost:11434/v1"
|
|
ai_api_key: str = ""
|
|
ai_model: str = "llama3.2:3b"
|
|
ai_timeout_seconds: float = 20.0
|
|
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
|
|
|
|
@property
|
|
def origins(self) -> list[str]:
|
|
return [item.strip() for item in self.allowed_origins.split(",") if item.strip()]
|
|
|
|
|
|
@lru_cache
|
|
def get_settings() -> Settings:
|
|
return Settings()
|