forked from mtusi2026/mtusi2026lab3
25 lines
765 B
Python
25 lines
765 B
Python
import os
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
app_name: str = "Messenger API"
|
|
app_env: str = "lab"
|
|
database_url: str = "postgresql+psycopg://messenger:messenger@postgres:5432/messenger"
|
|
db_pool_size: int = 5
|
|
db_max_overflow: int = 5
|
|
db_pool_timeout: int = 10
|
|
session_ttl_seconds: int = 3600
|
|
cache_url: str = "redis://redis:6379/0"
|
|
message_cache_ttl_seconds: int = 60
|
|
idempotency_ttl_seconds: int = 86400
|
|
instance_id: str = os.getenv("INSTANCE_ID") or os.getenv("HOSTNAME") or "api-local"
|
|
shutdown_grace_seconds: int = 20
|
|
|
|
model_config = SettingsConfigDict(
|
|
env_file=".env", env_file_encoding="utf-8", extra="ignore"
|
|
)
|
|
|
|
|
|
settings = Settings()
|