Enable rate-limiting for the API.

This commit is contained in:
Christopher Glass
2015-10-02 14:05:06 +02:00
parent 0af9078ed0
commit ca94f0699d
6 changed files with 51 additions and 1 deletions

View File

@@ -409,3 +409,11 @@ class ConsoleSSLContext(context.OSContextGenerator):
ctxt['html5proxy_base_url'] = url
return ctxt
class APIRateLimitingContext(context.OSContextGenerator):
def __call__(self):
ctxt = {}
rate_rules = config('api-rate-limit-rules')
if rate_rules:
ctxt['api_rate_limit_rules'] = rate_rules
return ctxt