From df9639715b92f6e26222fef08b2559426377a6ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20P=C3=A9pin?= Date: Mon, 24 Aug 2020 14:55:27 +0200 Subject: [PATCH] Move COF-specific settings (channels) to common.py --- cof/settings/cof_prod.py | 42 ++++++++++++++++++++++++++++++++++++++++ cof/settings/common.py | 42 ---------------------------------------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/cof/settings/cof_prod.py b/cof/settings/cof_prod.py index 180e92a6..0f73841e 100644 --- a/cof/settings/cof_prod.py +++ b/cof/settings/cof_prod.py @@ -18,6 +18,11 @@ from .common import ( # COF-specific secrets # --- +REDIS_PASSWD = import_secret("REDIS_PASSWD") +REDIS_DB = import_secret("REDIS_DB") +REDIS_HOST = import_secret("REDIS_HOST") +REDIS_PORT = import_secret("REDIS_PORT") + RECAPTCHA_PUBLIC_KEY = import_secret("RECAPTCHA_PUBLIC_KEY") RECAPTCHA_PRIVATE_KEY = import_secret("RECAPTCHA_PRIVATE_KEY") KFETOPEN_TOKEN = import_secret("KFETOPEN_TOKEN") @@ -112,6 +117,43 @@ AUTHENTICATION_BACKENDS += [ LOGIN_URL = "cof-login" LOGIN_REDIRECT_URL = "home" +# --- +# Cache settings +# --- + +CACHES = { + "default": { + "BACKEND": "redis_cache.RedisCache", + "LOCATION": "redis://:{passwd}@{host}:{port}/{db}".format( + passwd=REDIS_PASSWD, host=REDIS_HOST, port=REDIS_PORT, db=REDIS_DB + ), + } +} + + +# --- +# Channels settings +# --- + +CHANNEL_LAYERS = { + "default": { + "BACKEND": "asgi_redis.RedisChannelLayer", + "CONFIG": { + "hosts": [ + ( + "redis://:{passwd}@{host}:{port}/{db}".format( + passwd=REDIS_PASSWD, + host=REDIS_HOST, + port=REDIS_PORT, + db=REDIS_DB, + ) + ) + ] + }, + "ROUTING": "cof.routing.routing", + } +} + # --- # reCAPTCHA settings diff --git a/cof/settings/common.py b/cof/settings/common.py index 0c34bf67..4636ace3 100644 --- a/cof/settings/common.py +++ b/cof/settings/common.py @@ -41,11 +41,6 @@ DBNAME = import_secret("DBNAME") DBUSER = import_secret("DBUSER") DBPASSWD = import_secret("DBPASSWD") -REDIS_PASSWD = import_secret("REDIS_PASSWD") -REDIS_DB = import_secret("REDIS_DB") -REDIS_HOST = import_secret("REDIS_HOST") -REDIS_PORT = import_secret("REDIS_PORT") - LDAP_SERVER_URL = import_secret("LDAP_SERVER_URL") @@ -146,40 +141,3 @@ CAS_LOGIN_MSG = None CAS_IGNORE_REFERER = True CAS_REDIRECT_URL = "/" CAS_EMAIL_FORMAT = "%s@clipper.ens.fr" - -# --- -# Cache settings -# --- - -CACHES = { - "default": { - "BACKEND": "redis_cache.RedisCache", - "LOCATION": "redis://:{passwd}@{host}:{port}/{db}".format( - passwd=REDIS_PASSWD, host=REDIS_HOST, port=REDIS_PORT, db=REDIS_DB - ), - } -} - - -# --- -# Channels settings -# --- - -CHANNEL_LAYERS = { - "default": { - "BACKEND": "asgi_redis.RedisChannelLayer", - "CONFIG": { - "hosts": [ - ( - "redis://:{passwd}@{host}:{port}/{db}".format( - passwd=REDIS_PASSWD, - host=REDIS_HOST, - port=REDIS_PORT, - db=REDIS_DB, - ) - ) - ] - }, - "ROUTING": "cof.routing.routing", - } -}