Nicolas Cantu 088eab84b7 Platform docs, services, ia_dev submodule, smart_ide project config
- Add ia_dev submodule (projects/smart_ide on forge 4nk)
- Document APIs, orchestrator, gateway, local-office, rollout
- Add systemd/scripts layout; relocate setup scripts
- Remove obsolete nginx/enso-only docs from this repo scope
2026-04-03 16:07:58 +02:00

19 lines
514 B
Python

"""Rate limiter keyed by X-API-Key (or IP if missing). Used by main and routes."""
from app.config import get_rate_limit_per_minute
from slowapi import Limiter
from slowapi.util import get_remote_address
def _key_func(request) -> str:
api_key = request.headers.get("X-API-Key") or get_remote_address(request)
return str(api_key)
limiter = Limiter(key_func=_key_func)
def rate_limit_string() -> str:
"""e.g. '60/minute' from config."""
n = get_rate_limit_per_minute()
return f"{n}/minute"