bb-plane-fork/apps/api/plane/settings/redis.py
sriram veeraghanta 02d0ee3e0f
chore: add copyright (#8584)
* feat: adding new copyright info on all files

* chore: adding CI
2026-01-27 13:54:22 +05:30

24 lines
610 B
Python

# Copyright (c) 2023-present Plane Software, Inc. and contributors
# SPDX-License-Identifier: AGPL-3.0-only
# See the LICENSE file for details.
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