Skip to content

Commit

Permalink
Fix Redis issue
Browse files Browse the repository at this point in the history
  • Loading branch information
oldfielj-ansto committed Oct 6, 2024
1 parent d2ae2c1 commit 9b4cfad
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions mxcubecore/HardwareObjects/DataPublisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import gevent
import logging

from os import environ
from enum import Enum, unique

from mxcubecore.BaseHardwareObjects import HardwareObject
Expand Down Expand Up @@ -92,12 +93,35 @@ def init(self):
"""
super(DataPublisher, self).init()

rhost = self.get_property("host", "localhost")
rport = self.get_property("port", 6379)
rdb = self.get_property("db", 11)
rhost = self.get_property(
"host",
environ.get("MXCUBE_REDIS_HOST", "localhost"),
)
rport = self.get_property(
"port",
int(environ.get("MXCUBE_REDIS_PORT", "6379")),
)
username = self.get_property(
"username",
environ.get("MXCUBE_REDIS_USERNAME"),
)
password = self.get_property(
"password",
environ.get("MXCUBE_REDIS_PASSWORD"),
)
rdb = self.get_property(
"db",
int(environ.get("MXCUBE_REDIS_DB", "11")),
)

self._r = redis.Redis(
host=rhost, port=rport, db=rdb, charset="utf-8", decode_responses=True
host=rhost,
port=rport,
username=username,
password=password,
db=rdb,
charset="utf-8",
decode_responses=True,
)

if not self._subsribe_task:
Expand Down

0 comments on commit 9b4cfad

Please sign in to comment.