plane/apiserver/plane/settings/redis.py
Nikhil eead64ba49 dev: squashed migrations (#2779)
* dev: migration squash

* dev: migrations squashed for apis and webhooks

* dev: packages updated and  move dj-database-url for local settings

* dev: update package changes
2023-12-07 19:59:35 +05:30

22 lines
475 B
Python

import os
import redis
from django.conf import settings
from urllib.parse import urlparse
def redis_instance():
# connect to redis
if settings.REDIS_SSL:
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.Redis.from_url(settings.REDIS_URL, db=0)
return ri