Files
game-marathon/backend/app/core/config.py

62 lines
1.6 KiB
Python
Raw Normal View History

2025-12-14 02:38:35 +07:00
from pydantic_settings import BaseSettings
from functools import lru_cache
class Settings(BaseSettings):
# App
APP_NAME: str = "Game Marathon"
DEBUG: bool = False
# Database
DATABASE_URL: str = "postgresql+asyncpg://marathon:marathon@localhost:5432/marathon"
# Security
SECRET_KEY: str = "your-secret-key-change-in-production"
ALGORITHM: str = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 7 # 7 days
# OpenAI
OPENAI_API_KEY: str = ""
# Telegram
TELEGRAM_BOT_TOKEN: str = ""
2025-12-16 20:06:16 +07:00
TELEGRAM_BOT_USERNAME: str = ""
TELEGRAM_LINK_TOKEN_EXPIRE_MINUTES: int = 10
2025-12-18 17:15:21 +07:00
BOT_API_SECRET: str = "" # Secret key for bot-to-backend communication
2025-12-14 02:38:35 +07:00
2025-12-16 22:43:03 +07:00
# Frontend
FRONTEND_URL: str = "http://localhost:3000"
2025-12-14 02:38:35 +07:00
# Uploads
UPLOAD_DIR: str = "uploads"
2025-12-17 00:04:14 +07:00
MAX_UPLOAD_SIZE: int = 5 * 1024 * 1024 # 5 MB for avatars
MAX_IMAGE_SIZE: int = 15 * 1024 * 1024 # 15 MB
MAX_VIDEO_SIZE: int = 30 * 1024 * 1024 # 30 MB
2025-12-14 02:38:35 +07:00
ALLOWED_IMAGE_EXTENSIONS: set = {"jpg", "jpeg", "png", "gif", "webp"}
ALLOWED_VIDEO_EXTENSIONS: set = {"mp4", "webm", "mov"}
2025-12-16 01:25:21 +07:00
# S3 Storage (FirstVDS)
S3_ENABLED: bool = False
S3_BUCKET_NAME: str = ""
S3_REGION: str = "ru-1"
S3_ACCESS_KEY_ID: str = ""
S3_SECRET_ACCESS_KEY: str = ""
S3_ENDPOINT_URL: str = ""
S3_PUBLIC_URL: str = ""
2025-12-14 02:38:35 +07:00
@property
def ALLOWED_EXTENSIONS(self) -> set:
return self.ALLOWED_IMAGE_EXTENSIONS | self.ALLOWED_VIDEO_EXTENSIONS
class Config:
env_file = ".env"
extra = "ignore"
@lru_cache
def get_settings() -> Settings:
return Settings()
settings = get_settings()