feat(rpc): enforce ratelimiting

New configuration options:

- `[ratelimit] cache`
    - A boolean indicating whether we should use configured cache (1)
      or database (0) for ratelimiting.

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-10-21 10:17:34 -07:00
parent 6662975005
commit 65240c8343
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
5 changed files with 280 additions and 2 deletions

View file

@ -48,6 +48,11 @@ redis_address = redis://localhost
[ratelimit]
request_limit = 4000
window_length = 86400
; Force-utilize cache for ratelimiting. In FastAPI, forced cache (1)
; will cause the ratelimit path to use a real or fake Redis instance
; depending on the configured options.cache setting. Otherwise,
; cache will be ignored and the database will be used.
cache = 1
[notifications]
notify-cmd = /usr/bin/aurweb-notify