2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-10-15 13:42:20 +00:00

Enhancement: Support Redis ACL User Logins (#10551)

* Adding support for modern Redis ACL user-baased auth

* Reverting pre-config

* Simplified to combine legacy and acl redis connection uris

---------

Co-authored-by: Austen Hoogen <austenwho@protonmail.com>
This commit is contained in:
Austen Hoogen
2025-10-12 17:53:24 -05:00
committed by GitHub
parent 30e91eb226
commit 466463ad74
3 changed files with 9 additions and 1 deletions

View File

@@ -43,6 +43,11 @@ def cache_password():
return cache_setting('password', None)
def cache_user():
"""Return the cash username."""
return cache_setting('user', None)
def is_global_cache_enabled() -> bool:
"""Check if the global cache is enabled.
@@ -85,9 +90,10 @@ def get_cache_config(global_cache: bool) -> dict:
if global_cache:
# Build Redis URL with optional password
password = cache_password()
user = cache_user() or ''
if password:
redis_url = f'redis://:{password}@{cache_host()}:{cache_port()}/0'
redis_url = f'redis://{user}:{password}@{cache_host()}:{cache_port()}/0'
else:
redis_url = f'redis://{cache_host()}:{cache_port()}/0'