Files
Messenger/app/config/settings.py

59 lines
2.0 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
run_migrations_on_startup: bool = False
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"
firebase_enabled: bool = False
firebase_credentials_path: str | None = None
firebase_credentials_json: str | None = None
firebase_webpush_link: str = "https://chat.daemonlord.ru/"
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()