mirror of
https://github.com/jazzband/django-defender.git
synced 2026-05-15 19:13:16 +00:00
Added ssl option when instantiating StrictRedis (#120)
This commit is contained in:
parent
250c4d5388
commit
066dd238c8
1 changed files with 6 additions and 1 deletions
|
|
@ -40,7 +40,9 @@ def get_redis_connection():
|
|||
host=redis_config.get('HOST'),
|
||||
port=redis_config.get('PORT'),
|
||||
db=redis_config.get('DB'),
|
||||
password=redis_config.get('PASSWORD'))
|
||||
password=redis_config.get('PASSWORD'),
|
||||
ssl=redis_config.get('SSL'))
|
||||
|
||||
|
||||
|
||||
def parse_redis_url(url):
|
||||
|
|
@ -52,6 +54,7 @@ def parse_redis_url(url):
|
|||
"PASSWORD": None,
|
||||
"HOST": "localhost",
|
||||
"PORT": 6379,
|
||||
"SSL": False
|
||||
}
|
||||
|
||||
if not url:
|
||||
|
|
@ -70,5 +73,7 @@ def parse_redis_url(url):
|
|||
redis_config.update({"HOST": url.hostname})
|
||||
if url.port:
|
||||
redis_config.update({"PORT": int(url.port)})
|
||||
if url.scheme in ['https', 'rediss']:
|
||||
redis_config.update({"SSL": True})
|
||||
|
||||
return redis_config
|
||||
|
|
|
|||
Loading…
Reference in a new issue