Skip to content
This repository was archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
changed limiter backend to redis #346
Browse files Browse the repository at this point in the history
  • Loading branch information
kshitijrajsharma committed Sep 30, 2022
1 parent 3f6b2b5 commit 17a38d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion docs/CONFIG_DOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ max_area=100000 # max area to support for rawdata input
use_connection_pooling=True # default it will not use connection pooling but you can configure api to use to for psycopg2 connections
log_level=info #options are info,debug,warning,error
env=dev # default is dev , supported values are dev and prod
allow_bind_zip_filter=true # default is false, this will allow people to choose either their output should be zipped or not . Default all output will be zipped
allow_bind_zip_filter=true # option to configure export output zipped/unzipped Default all output will be zipped
limiter_storage_uri=redis://localhost:6379 # API uses redis as backend for rate limiting
export_rate_limit=5 # no of requests per minute - default is 5 requests per minute
```
Based on your requirement you can also customize rawdata exports parameter using EXPORT_UPLOAD block
Expand Down
5 changes: 4 additions & 1 deletion src/galaxy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@
config = ConfigParser()
config.read(CONFIG_FILE_PATH)

limiter = Limiter(key_func=get_remote_address) # rate limiter for API requests
limiter_storage_uri = config.get(
"API_CONFIG", "limiter_storage_uri", fallback="redis://localhost:6379"
)
limiter = Limiter(key_func=get_remote_address, storage_uri=limiter_storage_uri) # rate limiter for API requests based on the remote ip address and redis as backend
export_rate_limit = int(config.get("API_CONFIG", "export_rate_limit", fallback=5))
# get log level from config
log_level = config.get("API_CONFIG", "log_level", fallback=None)
Expand Down

0 comments on commit 17a38d6

Please sign in to comment.