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

11 lines
305 B
Python
Raw Normal View History

2025-12-18 17:15:21 +07:00
from slowapi import Limiter
from slowapi.util import get_remote_address
from app.core.config import settings
2025-12-18 17:15:21 +07:00
# Rate limiter using client IP address as key
# Can be disabled via RATE_LIMIT_ENABLED=false in .env
limiter = Limiter(
key_func=get_remote_address,
enabled=settings.RATE_LIMIT_ENABLED
)