forked from github/plane
dev: redis instance rewrite for ssl settings and remove REDIS_TLS env variable
This commit is contained in:
parent
70e96be8fa
commit
a960ddedf7
@ -163,11 +163,6 @@ CSRF_COOKIE_SECURE = True
|
||||
|
||||
REDIS_URL = os.environ.get("REDIS_URL")
|
||||
|
||||
REDIS_TLS_URL = os.environ.get("REDIS_TLS_URL")
|
||||
|
||||
if REDIS_TLS_URL:
|
||||
REDIS_URL = REDIS_TLS_URL
|
||||
|
||||
CACHES = {
|
||||
"default": {
|
||||
"BACKEND": "django_redis.cache.RedisCache",
|
||||
|
@ -1,13 +1,20 @@
|
||||
import redis
|
||||
import os
|
||||
from django.conf import settings
|
||||
from urllib.parse import urlparse
|
||||
|
||||
|
||||
def redis_instance():
|
||||
if settings.REDIS_URL:
|
||||
ri = redis.from_url(settings.REDIS_URL, db=0)
|
||||
url = urlparse(settings.REDIS_URL)
|
||||
ri = redis.Redis(
|
||||
host=url.hostname,
|
||||
port=url.port,
|
||||
password=url.password,
|
||||
ssl=True,
|
||||
ssl_cert_reqs=None,
|
||||
)
|
||||
else:
|
||||
ri = redis.StrictRedis(host=settings.REDIS_HOST, port=settings.REDIS_PORT, db=0)
|
||||
ri = redis.StrictRedis(
|
||||
host=settings.REDIS_HOST, port=settings.REDIS_PORT, db=0
|
||||
)
|
||||
|
||||
return ri
|
||||
return ri
|
@ -163,11 +163,6 @@ CSRF_COOKIE_SECURE = True
|
||||
|
||||
REDIS_URL = os.environ.get("REDIS_URL")
|
||||
|
||||
REDIS_TLS_URL = os.environ.get("REDIS_TLS_URL")
|
||||
|
||||
if REDIS_TLS_URL:
|
||||
REDIS_URL = REDIS_TLS_URL
|
||||
|
||||
CACHES = {
|
||||
"default": {
|
||||
"BACKEND": "django_redis.cache.RedisCache",
|
||||
|
Loading…
Reference in New Issue
Block a user