mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-23 18:04:34 +00:00
feat: add ssl mode with non url connection + add redis cluster support (#494)
This commit is contained in:
co-authored by
GitHub
parent
416a4660ae
commit
e529e00fd7
+15
-3
@@ -40,8 +40,10 @@ url = os.getenv("ODOO_SESSION_REDIS_URL")
|
||||
password = os.getenv("ODOO_SESSION_REDIS_PASSWORD")
|
||||
expiration = os.getenv("ODOO_SESSION_REDIS_EXPIRATION")
|
||||
anon_expiration = os.getenv("ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS")
|
||||
|
||||
|
||||
# For non url connections
|
||||
ssl = os.getenv("ODOO_SESSION_REDIS_SSL", "1")
|
||||
ssl_cert_reqs = os.getenv("ODOO_SESSION_REDIS_SSL_CERT_REQS", "1")
|
||||
redis_cluster = os.getenv("ODOO_SESSION_REDIS_CLUSTER", "0")
|
||||
@lazy_property
|
||||
def session_store(self):
|
||||
if sentinel_host:
|
||||
@@ -49,8 +51,18 @@ def session_store(self):
|
||||
redis_client = sentinel.master_for(sentinel_master_name)
|
||||
elif url:
|
||||
redis_client = redis.from_url(url)
|
||||
elif is_true(redis_cluster):
|
||||
redis_client = redis.RedisCluster(
|
||||
host=host,
|
||||
port=port,
|
||||
password=password,
|
||||
ssl=is_true(ssl),
|
||||
ssl_cert_reqs=is_true(ssl_cert_reqs))
|
||||
else:
|
||||
redis_client = redis.Redis(host=host, port=port, password=password)
|
||||
redis_client = redis.Redis(
|
||||
host=host, port=port, password=password,
|
||||
ssl=is_true(ssl),
|
||||
ssl_cert_reqs=is_true(ssl_cert_reqs))
|
||||
return RedisSessionStore(
|
||||
redis=redis_client,
|
||||
prefix=prefix,
|
||||
|
||||
Reference in New Issue
Block a user