root: fix redis passwords not being encoded correctly
closes #2130 Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
01c80a82e2
commit
c2586557d8
|
@ -18,7 +18,7 @@ from hashlib import sha512
|
|||
from json import dumps
|
||||
from tempfile import gettempdir
|
||||
from time import time
|
||||
from urllib.parse import quote
|
||||
from urllib.parse import quote_plus
|
||||
|
||||
import structlog
|
||||
from celery.schedules import crontab
|
||||
|
@ -220,7 +220,7 @@ if CONFIG.y_bool("redis.tls", False):
|
|||
REDIS_CELERY_TLS_REQUIREMENTS = f"?ssl_cert_reqs={CONFIG.y('redis.tls_reqs')}"
|
||||
_redis_url = (
|
||||
f"{REDIS_PROTOCOL_PREFIX}:"
|
||||
f"{quote(CONFIG.y('redis.password'))}@{quote(CONFIG.y('redis.host'))}:"
|
||||
f"{quote_plus(CONFIG.y('redis.password'))}@{quote_plus(CONFIG.y('redis.host'))}:"
|
||||
f"{int(CONFIG.y('redis.port'))}"
|
||||
)
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@ def j_print(event: str, log_level: str = "info", **kwargs):
|
|||
print(dumps(data), file=stderr)
|
||||
|
||||
|
||||
j_print("Starting authentik bootstrap")
|
||||
|
||||
# Sanity check, ensure SECRET_KEY is set before we even check for database connectivity
|
||||
if CONFIG.y("secret_key") is None or len(CONFIG.y("secret_key")) == 0:
|
||||
j_print("----------------------------------------------------------------------")
|
||||
|
@ -47,7 +49,9 @@ while True:
|
|||
break
|
||||
except OperationalError as exc:
|
||||
sleep(1)
|
||||
j_print(f"PostgreSQL Connection failed, retrying... ({exc})")
|
||||
j_print(f"PostgreSQL connection failed, retrying... ({exc})")
|
||||
finally:
|
||||
j_print("PostgreSQL connection successful")
|
||||
|
||||
REDIS_PROTOCOL_PREFIX = "redis://"
|
||||
if CONFIG.y_bool("redis.tls", False):
|
||||
|
@ -65,3 +69,7 @@ while True:
|
|||
except RedisError as exc:
|
||||
sleep(1)
|
||||
j_print(f"Redis Connection failed, retrying... ({exc})", redis_url=REDIS_URL)
|
||||
finally:
|
||||
j_print("Redis Connection successful")
|
||||
|
||||
j_print("Finished authentik bootstrap")
|
||||
|
|
Reference in New Issue