feat: Migrate to MySQL and add unified environment configuration
## Database Migration (SQLite → MySQL) - Add Alembic migration framework - Add 'tr_' prefix to all tables to avoid conflicts in shared database - Remove SQLite support, use MySQL exclusively - Add pymysql driver dependency - Change ad_token column to Text type for long JWT tokens ## Unified Environment Configuration - Centralize all hardcoded settings to environment variables - Backend: Extend Settings class in app/core/config.py - Frontend: Use Vite environment variables (import.meta.env) - Docker: Move credentials to environment variables - Update .env.example files with comprehensive documentation ## Test Organization - Move root-level test files to tests/ directory: - test_chat_room.py → tests/test_chat_room.py - test_websocket.py → tests/test_websocket.py - test_realtime_implementation.py → tests/test_realtime_implementation.py - Fix path references in test_realtime_implementation.py Breaking Changes: - CORS now requires explicit origins (no more wildcard) - All database tables renamed with 'tr_' prefix - SQLite no longer supported 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,10 @@ import asyncio
|
||||
import json
|
||||
from collections import defaultdict
|
||||
|
||||
from app.core.config import get_settings
|
||||
|
||||
settings = get_settings()
|
||||
|
||||
|
||||
def json_serializer(obj: Any) -> str:
|
||||
"""Custom JSON serializer for objects not serializable by default json code"""
|
||||
@@ -193,9 +197,11 @@ class WebSocketManager:
|
||||
if user_id in self._typing_tasks:
|
||||
self._typing_tasks[user_id].cancel()
|
||||
|
||||
# Set new timeout (3 seconds)
|
||||
# Set new timeout (configurable via TYPING_TIMEOUT_SECONDS)
|
||||
typing_timeout = settings.TYPING_TIMEOUT_SECONDS
|
||||
|
||||
async def clear_typing():
|
||||
await asyncio.sleep(3)
|
||||
await asyncio.sleep(typing_timeout)
|
||||
self._typing_users[room_id].discard(user_id)
|
||||
if user_id in self._typing_tasks:
|
||||
del self._typing_tasks[user_id]
|
||||
|
||||
Reference in New Issue
Block a user