root: url quote redis passwords for connection string

closes https://github.com/goauthentik/helm/issues/39

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-11-25 18:05:36 +01:00
parent ef994e0084
commit 363aed2a47
1 changed files with 2 additions and 1 deletions

View File

@ -18,6 +18,7 @@ from hashlib import sha512
from json import dumps from json import dumps
from tempfile import gettempdir from tempfile import gettempdir
from time import time from time import time
from urllib.parse import quote
import structlog import structlog
from celery.schedules import crontab from celery.schedules import crontab
@ -223,7 +224,7 @@ CACHES = {
"BACKEND": "django_redis.cache.RedisCache", "BACKEND": "django_redis.cache.RedisCache",
"LOCATION": ( "LOCATION": (
f"{REDIS_PROTOCOL_PREFIX}:" f"{REDIS_PROTOCOL_PREFIX}:"
f"{CONFIG.y('redis.password')}@{CONFIG.y('redis.host')}:" f"{quote(CONFIG.y('redis.password'))}@{quote(CONFIG.y('redis.host'))}:"
f"{int(CONFIG.y('redis.port'))}/{CONFIG.y('redis.cache_db')}" f"{int(CONFIG.y('redis.port'))}/{CONFIG.y('redis.cache_db')}"
), ),
"TIMEOUT": int(CONFIG.y("redis.cache_timeout", 300)), "TIMEOUT": int(CONFIG.y("redis.cache_timeout", 300)),