38 lines
1.0 KiB
Python
38 lines
1.0 KiB
Python
from functools import lru_cache
|
|
|
|
from pydantic import Field
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
app_name: str = "AI Palm Reading"
|
|
environment: str = "development"
|
|
database_url: str = "sqlite+aiosqlite:///./palm_reading.db"
|
|
secret_key: str = "change-me-in-production"
|
|
access_token_expire_minutes: int = 60 * 24 * 30
|
|
cors_origins: list[str] = Field(default_factory=lambda: ["*"])
|
|
|
|
openai_api_key: str | None = None
|
|
openai_base_url: str | None = None
|
|
openai_model: str = "gpt-4.1-mini"
|
|
openai_image_model: str = "gpt-image-2"
|
|
share_image_mode: str = "ai"
|
|
|
|
wechat_app_id: str | None = None
|
|
wechat_app_secret: str | None = None
|
|
wechat_mock_login: bool = True
|
|
|
|
upload_dir: str = "./storage/uploads"
|
|
image_retention_days: int = 7
|
|
max_image_mb: int = 8
|
|
|
|
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8")
|
|
|
|
|
|
@lru_cache
|
|
def get_settings() -> Settings:
|
|
return Settings()
|
|
|
|
|
|
settings = get_settings()
|