mirror of
https://github.com/rommapp/romm.git
synced 2026-02-18 00:27:41 +01:00
fix: Improve handling of Redis URL
This change replaces the creation of Redis URL, from a simple string interpolation, to using `yarl.URL`. The main benefit, besides not forgetting to set all five different variables on every Redis client initialization, is that user credentials are correctly URL-encoded, if present. Up until now, if a password had special characters, it could break the generated URL. This change also introduces support for a `REDIS_SSL` setting, which allows the user to specify if the Redis connection should use SSL or not.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import socketio # type: ignore
|
||||
from handler.redis_handler import redis_url
|
||||
from config import REDIS_URL
|
||||
|
||||
|
||||
class SocketHandler:
|
||||
@@ -9,7 +9,7 @@ class SocketHandler:
|
||||
async_mode="asgi",
|
||||
logger=False,
|
||||
engineio_logger=False,
|
||||
client_manager=socketio.AsyncRedisManager(redis_url),
|
||||
client_manager=socketio.AsyncRedisManager(str(REDIS_URL)),
|
||||
)
|
||||
|
||||
self.socket_app = socketio.ASGIApp(
|
||||
|
||||
Reference in New Issue
Block a user