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