Files
Messenger/app/config/settings.py
benya ffd63018d6
All checks were successful
CI / test (push) Successful in 26s
fix: make media uploads work behind docker
- add S3_PUBLIC_ENDPOINT_URL for browser-reachable presigned urls

- support both public/internal file url validation

- configure MinIO bucket CORS in minio-init

- update env examples and docs
2026-03-07 22:52:05 +03:00

54 lines
1.8 KiB
Python

from pydantic import Field
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
app_name: str = "BenyaMessenger"
environment: str = "development"
debug: bool = True
api_v1_prefix: str = "/api/v1"
auto_create_tables: bool = True
secret_key: str = Field(default="change-me-please-12345", min_length=16)
access_token_expire_minutes: int = 30
refresh_token_expire_days: int = 30
jwt_algorithm: str = "HS256"
email_verification_token_expire_hours: int = 24
password_reset_token_expire_hours: int = 1
postgres_dsn: str = "postgresql+asyncpg://postgres:postgres@localhost:5432/messenger"
redis_url: str = "redis://localhost:6379/0"
s3_endpoint_url: str = "http://localhost:9000"
s3_public_endpoint_url: str | None = None
s3_access_key: str = "minioadmin"
s3_secret_key: str = "minioadmin"
s3_region: str = "us-east-1"
s3_bucket_name: str = "messenger-media"
s3_presign_expire_seconds: int = 900
max_upload_size_bytes: int = 104857600
frontend_base_url: str = "http://localhost:5173"
smtp_host: str = "localhost"
smtp_port: int = 1025
smtp_username: str = ""
smtp_password: str = ""
email_provider: str = "log"
smtp_use_tls: bool = False
smtp_use_ssl: bool = False
smtp_timeout_seconds: float = 10.0
smtp_from_email: str = "no-reply@benyamessenger.local"
login_rate_limit_per_minute: int = 10
register_rate_limit_per_minute: int = 5
reset_rate_limit_per_minute: int = 5
refresh_rate_limit_per_minute: int = 30
message_rate_limit_per_minute: int = 30
duplicate_message_cooldown_seconds: int = 10
celery_task_always_eager: bool = False
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore")
settings = Settings()