Allow for Configurable Redis Port (#1124)
* root: make redis port configurable * root: parse redis port from config as an integer * code formatting * lifecycle: truncate line under 100 chars * lifecycle: incorrect indenting on newline
This commit is contained in:
parent
a62e3557ac
commit
5cfbb0993a
|
@ -13,6 +13,7 @@ web:
|
|||
|
||||
redis:
|
||||
host: localhost
|
||||
port: 6379
|
||||
password: ''
|
||||
cache_db: 0
|
||||
message_queue_db: 1
|
||||
|
|
|
@ -192,8 +192,8 @@ CACHES = {
|
|||
"default": {
|
||||
"BACKEND": "django_redis.cache.RedisCache",
|
||||
"LOCATION": (
|
||||
f"redis://:{CONFIG.y('redis.password')}@{CONFIG.y('redis.host')}:6379"
|
||||
f"/{CONFIG.y('redis.cache_db')}"
|
||||
f"redis://:{CONFIG.y('redis.password')}@{CONFIG.y('redis.host')}:"
|
||||
f"{int(CONFIG.y('redis.port'))}/{CONFIG.y('redis.cache_db')}"
|
||||
),
|
||||
"TIMEOUT": int(CONFIG.y("redis.cache_timeout", 300)),
|
||||
"OPTIONS": {"CLIENT_CLASS": "django_redis.client.DefaultClient"},
|
||||
|
@ -252,8 +252,8 @@ CHANNEL_LAYERS = {
|
|||
"BACKEND": "channels_redis.core.RedisChannelLayer",
|
||||
"CONFIG": {
|
||||
"hosts": [
|
||||
f"redis://:{CONFIG.y('redis.password')}@{CONFIG.y('redis.host')}:6379"
|
||||
f"/{CONFIG.y('redis.ws_db')}"
|
||||
f"redis://:{CONFIG.y('redis.password')}@{CONFIG.y('redis.host')}:"
|
||||
f"{int(CONFIG.y('redis.port'))}/{CONFIG.y('redis.ws_db')}"
|
||||
],
|
||||
},
|
||||
},
|
||||
|
@ -332,11 +332,11 @@ CELERY_TASK_CREATE_MISSING_QUEUES = True
|
|||
CELERY_TASK_DEFAULT_QUEUE = "authentik"
|
||||
CELERY_BROKER_URL = (
|
||||
f"redis://:{CONFIG.y('redis.password')}@{CONFIG.y('redis.host')}"
|
||||
f":6379/{CONFIG.y('redis.message_queue_db')}"
|
||||
f":{int(CONFIG.y('redis.port'))}/{CONFIG.y('redis.message_queue_db')}"
|
||||
)
|
||||
CELERY_RESULT_BACKEND = (
|
||||
f"redis://:{CONFIG.y('redis.password')}@{CONFIG.y('redis.host')}"
|
||||
f":6379/{CONFIG.y('redis.message_queue_db')}"
|
||||
f":{int(CONFIG.y('redis.port'))}/{CONFIG.y('redis.message_queue_db')}"
|
||||
)
|
||||
|
||||
# Database backup
|
||||
|
|
|
@ -43,8 +43,8 @@ while True:
|
|||
while True:
|
||||
try:
|
||||
redis = Redis.from_url(
|
||||
f"redis://:{CONFIG.y('redis.password')}@{CONFIG.y('redis.host')}:6379"
|
||||
f"/{CONFIG.y('redis.ws_db')}"
|
||||
f"redis://:{CONFIG.y('redis.password')}@{CONFIG.y('redis.host')}:"
|
||||
f"{int(CONFIG.y('redis.port'))}/{CONFIG.y('redis.ws_db')}"
|
||||
)
|
||||
redis.ping()
|
||||
break
|
||||
|
|
Reference in New Issue