Files
Nirodan 80ec5eca7b Security, code quality and frontend improvements
- Move SECRET_KEY out of docker-compose into .env (env_file), add .env.example
- Add flask-limiter with 10 req/min on login route; introduce util/limiter.py
- Replace direct mysql.connector.connect() calls with MySQLConnectionPool via util/db_pool.py
- Fix deprecated datetime.utcnow() -> datetime.now(timezone.utc) in auth/login.py
- Remove dead /api/scripts 410 route from admin.py
- Add MD5 security warning in Md5Tool.jsx
- Add ErrorBoundary component and wrap App.jsx
- Expand README with setup guide, screenshot and project structure

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 13:52:53 +02:00

27 lines
686 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import mysql.connector.pooling
from util.logger import logger
_pool = None
def get_connection():
global _pool
if _pool is None:
from util.db_config import load_config
config = load_config()
if not config:
raise RuntimeError("DB-Konfiguration nicht verfügbar")
_pool = mysql.connector.pooling.MySQLConnectionPool(
pool_name="tools_pool",
pool_size=5,
**config
)
logger.info("DB-Verbindungspool erstellt (pool_size=5)")
return _pool.get_connection()
def reset_pool():
"""Pool zurücksetzen nach Konfigurationsänderung aufrufen."""
global _pool
_pool = None