From 66e9756ff17be53b0e960eaae9f2c56c68af95a4 Mon Sep 17 00:00:00 2001 From: Taylor Fuller Date: Mon, 12 Aug 2024 23:23:01 -0700 Subject: [PATCH 1/4] revise django-redis config --- extras/docker/development/settings.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/extras/docker/development/settings.py b/extras/docker/development/settings.py index 23a81c51d..ca8223928 100644 --- a/extras/docker/development/settings.py +++ b/extras/docker/development/settings.py @@ -111,6 +111,12 @@ 'TIMEOUT': env.int("DJANGO_CACHE_TIMEOUT"), 'OPTIONS': { 'CLIENT_CLASS': env.str("DJANGO_CACHE_CLIENT_CLASS"), + 'CONNECTION_POOL_KWARGS': { + "ssl_keyfile": env.str('DJANGO_CACHE_CLIENT_SSL_KEY_FILE', None), + "ssl_certfile": env.str('DJANGO_CACHE_CLIENT_SSL_CERT_FILE', None), + "ssl_cert_reqs": env.str('DJANGO_CACHE_CLIENT_SSL_CERT_REQS', 'required'), + "ssl_check_hostname": env.str('DJANGO_CACHE_CLIENT_SSL_CHECK_HOSTNAME', False) + } } } } From d8555d08c92f947ce2eb8836997b0d632f0457d5 Mon Sep 17 00:00:00 2001 From: Taylor Fuller Date: Tue, 13 Aug 2024 00:24:54 -0700 Subject: [PATCH 2/4] add to authors --- AUTHORS.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index 72b25db96..cc608ced5 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -79,6 +79,7 @@ Developers * Ethan Winters - https://github.com/ebwinters * Dieter Plaetinck - https://github.com/Dieterbe * Jonathan La Field - https://github.com/JLaField +* Taylor Fuller - https://github.com/taylor-fuller Translators From 8afe3c490348622223b1d9095c8d4ff27fb847ba Mon Sep 17 00:00:00 2001 From: Taylor Fuller Date: Thu, 29 Aug 2024 15:29:29 -0700 Subject: [PATCH 3/4] only set if specified --- extras/docker/development/settings.py | 28 ++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/extras/docker/development/settings.py b/extras/docker/development/settings.py index ca8223928..796a28fba 100644 --- a/extras/docker/development/settings.py +++ b/extras/docker/development/settings.py @@ -110,13 +110,7 @@ 'LOCATION': env.str("DJANGO_CACHE_LOCATION"), 'TIMEOUT': env.int("DJANGO_CACHE_TIMEOUT"), 'OPTIONS': { - 'CLIENT_CLASS': env.str("DJANGO_CACHE_CLIENT_CLASS"), - 'CONNECTION_POOL_KWARGS': { - "ssl_keyfile": env.str('DJANGO_CACHE_CLIENT_SSL_KEY_FILE', None), - "ssl_certfile": env.str('DJANGO_CACHE_CLIENT_SSL_CERT_FILE', None), - "ssl_cert_reqs": env.str('DJANGO_CACHE_CLIENT_SSL_CERT_REQS', 'required'), - "ssl_check_hostname": env.str('DJANGO_CACHE_CLIENT_SSL_CHECK_HOSTNAME', False) - } + 'CLIENT_CLASS': env.str("DJANGO_CACHE_CLIENT_CLASS") } } } @@ -124,6 +118,26 @@ if os.environ.get('DJANGO_CACHE_CLIENT_PASSWORD'): CACHES['default']['OPTIONS']['PASSWORD'] = env.str('DJANGO_CACHE_CLIENT_PASSWORD') + CONNECTION_POOL_KWARGS = dict() + if "DJANGO_CACHE_CLIENT_SSL_KEYFILE" in os.environ: + CONNECTION_POOL_KWARGS.update( + {"ssl_keyfile", env.str("DJANGO_CACHE_CLIENT_SSL_KEYFILE")}) + + if "DJANGO_CACHE_CLIENT_SSL_CERTFILE" in os.environ: + CONNECTION_POOL_KWARGS.update( + {"ssl_certfile", env.str("DJANGO_CACHE_CLIENT_SSL_CERTFILE")}) + + if "DJANGO_CACHE_CLIENT_SSL_CERT_REQS" in os.environ: + CONNECTION_POOL_KWARGS.update( + {"ssl_cert_reqs", env.str("DJANGO_CACHE_CLIENT_SSL_CERT_REQS")}) + + if "DJANGO_CACHE_CLIENT_SSL_CHECK_HOSTNAME" in os.environ: + CONNECTION_POOL_KWARGS.update( + {"ssl_check_hostname", env.bool("DJANGO_CACHE_CLIENT_SSL_CHECK_HOSTNAME")}) + + if len(CONNECTION_POOL_KWARGS) > 0: + CACHES["default"]["OPTIONS"]["CONNECTION_POOL_KWARGS"] = CONNECTION_POOL_KWARGS + # Folder for compressed CSS and JS files COMPRESS_ROOT = STATIC_ROOT From 1a1f631ff092d852b7763f2eaafbc2dfb2d065ae Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 25 Sep 2024 18:59:09 +0200 Subject: [PATCH 4/4] Write the updates a bit more compactly --- extras/docker/development/settings.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/extras/docker/development/settings.py b/extras/docker/development/settings.py index 796a28fba..8cfd02bde 100644 --- a/extras/docker/development/settings.py +++ b/extras/docker/development/settings.py @@ -120,22 +120,19 @@ CONNECTION_POOL_KWARGS = dict() if "DJANGO_CACHE_CLIENT_SSL_KEYFILE" in os.environ: - CONNECTION_POOL_KWARGS.update( - {"ssl_keyfile", env.str("DJANGO_CACHE_CLIENT_SSL_KEYFILE")}) + CONNECTION_POOL_KWARGS['ssl_keyfile'] = env.str("DJANGO_CACHE_CLIENT_SSL_KEYFILE") if "DJANGO_CACHE_CLIENT_SSL_CERTFILE" in os.environ: - CONNECTION_POOL_KWARGS.update( - {"ssl_certfile", env.str("DJANGO_CACHE_CLIENT_SSL_CERTFILE")}) + CONNECTION_POOL_KWARGS['ssl_certfile'] = env.str("DJANGO_CACHE_CLIENT_SSL_CERTFILE") if "DJANGO_CACHE_CLIENT_SSL_CERT_REQS" in os.environ: - CONNECTION_POOL_KWARGS.update( - {"ssl_cert_reqs", env.str("DJANGO_CACHE_CLIENT_SSL_CERT_REQS")}) + CONNECTION_POOL_KWARGS['ssl_cert_reqs'] = env.str("DJANGO_CACHE_CLIENT_SSL_CERT_REQS") if "DJANGO_CACHE_CLIENT_SSL_CHECK_HOSTNAME" in os.environ: - CONNECTION_POOL_KWARGS.update( - {"ssl_check_hostname", env.bool("DJANGO_CACHE_CLIENT_SSL_CHECK_HOSTNAME")}) + CONNECTION_POOL_KWARGS['ssl_check_hostname'] = env.bool( + "DJANGO_CACHE_CLIENT_SSL_CHECK_HOSTNAME") - if len(CONNECTION_POOL_KWARGS) > 0: + if CONNECTION_POOL_KWARGS: CACHES["default"]["OPTIONS"]["CONNECTION_POOL_KWARGS"] = CONNECTION_POOL_KWARGS # Folder for compressed CSS and JS files