Skip to content

Commit

Permalink
ratelimit: add app config examples
Browse files Browse the repository at this point in the history
  • Loading branch information
CounterPillow committed Jun 22, 2020
1 parent b429e65 commit 379f124
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions config.example.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,12 @@
# 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_"
2 changes: 1 addition & 1 deletion nyaa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def internal_error(exception):
# Cache
cache.init_app(app, config=app.config)

# Rate Limiting
# Rate Limiting, reads app.config itself
limiter.init_app(app)

return app

0 comments on commit 379f124

Please sign in to comment.