LogicGoInfotechSpaces's picture
Update app/core/config.py
efdef95 verified
raw
history blame
999 Bytes
from functools import lru_cache
from pydantic import Field
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore")
mongo_uri: str = Field(..., alias="MONGO_URI")
mongo_db: str = Field("expense", alias="MONGO_DB")
mongo_collection: str = Field("headcategories", alias="MONGO_COLLECTION")
mongo_subcategory_collection: str = Field("categories", alias="MONGO_SUBCATEGORY_COLLECTION")
api_logs_collection: str = Field("api_logs", alias="MONGO_API_LOGS_COLLECTION")
openai_api_key: str = Field(..., alias="OPENAI_API_KEY")
openai_model: str = Field("gpt-4o-mini", alias="OPENAI_MODEL")
category_cache_ttl_seconds: int = Field(300, alias="CATEGORY_CACHE_TTL")
use_static_categories: bool = Field(True, alias="USE_STATIC_CATEGORIES")
@lru_cache
def get_settings() -> Settings:
return Settings()
settings = get_settings()