36 lines
958 B
Python
36 lines
958 B
Python
"""Configuration for CV Application."""
|
|
import os
|
|
from pydantic_settings import BaseSettings
|
|
from functools import lru_cache
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
# Database
|
|
db_host: str = "localhost"
|
|
db_port: int = 5432
|
|
db_name: str = "cvapp"
|
|
db_user: str = "cvapp"
|
|
db_password: str = "cvapp2026"
|
|
|
|
# LLM (Ollama Cloud)
|
|
llm_api_key: str = os.getenv("OLLAMA_API_KEY", "")
|
|
llm_base_url: str = "https://ollama.com/v1"
|
|
llm_model: str = "glm-5.2"
|
|
llm_vision_model: str = "gemini-3-flash-preview"
|
|
|
|
# App
|
|
app_host: str = "0.0.0.0"
|
|
app_port: int = 8770
|
|
upload_dir: str = os.path.join(os.path.dirname(os.path.abspath(__file__)), "uploads")
|
|
|
|
@property
|
|
def database_url(self) -> str:
|
|
return f"postgresql://{self.db_user}:{self.db_password}@{self.db_host}:{self.db_port}/{self.db_name}"
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
|
|
|
|
@lru_cache()
|
|
def get_settings() -> Settings:
|
|
return Settings() |