From 6ec934a77e629cfe4848e6e96d0416d6db0b2c6c Mon Sep 17 00:00:00 2001 From: Nicolas F Date: Mon, 22 Jun 2020 23:27:17 +0200 Subject: [PATCH] ratelimit: add app config examples --- config.example.py | 9 +++++++++ nyaa/__init__.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/config.example.py b/config.example.py index 8107de2..d54a43c 100644 --- a/config.example.py +++ b/config.example.py @@ -205,3 +205,12 @@ CACHE_THRESHOLD = 8192 # CACHE_TYPE = "redis" # CACHE_REDIS_HOST = "127.0.0.1" # CACHE_KEY_PREFIX = "catcache_" + + +############### +## Ratelimit ## +############### + +# To actually make this work across multiple worker processes, use redis +# RATELIMIT_STORAGE_URL="redis://host:port" +RATELIMIT_KEY_PREFIX="nyaaratelimit_" diff --git a/nyaa/__init__.py b/nyaa/__init__.py index ea06ef2..241a6fb 100644 --- a/nyaa/__init__.py +++ b/nyaa/__init__.py @@ -128,7 +128,7 @@ def create_app(config): # Cache cache.init_app(app, config=app.config) - # Rate Limiting + # Rate Limiting, reads app.config itself limiter.init_app(app) return app