Skip to content

Commit 1e4ca8c

Browse files
committed
Remove the need for an ispyb environment variable
1 parent 46ad843 commit 1e4ca8c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/murfey/server/ispyb.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import datetime
44
import logging
5-
import os
65
from typing import Callable, List, Optional
76

87
import ispyb
@@ -31,9 +30,11 @@
3130
url,
3231
)
3332

33+
from murfey.util.config import get_security_config
3434
from murfey.util.models import FoilHoleParameters, GridSquareParameters, Sample, Visit
3535

3636
log = logging.getLogger("murfey.server.ispyb")
37+
security_config = get_security_config()
3738

3839
try:
3940
Session = sqlalchemy.orm.sessionmaker(
@@ -60,7 +61,11 @@ def __init__(self, transport_type):
6061
self.transport = workflows.transport.lookup(transport_type)()
6162
self.transport.connect()
6263
self.feedback_queue = ""
63-
self.ispyb = ispyb.open() if os.getenv("ISYPB_CREDENTIALS") else None
64+
self.ispyb = (
65+
ispyb.open(credentials=security_config.ispyb_credentials)
66+
if security_config.ispyb_credentials
67+
else None
68+
)
6469
self._connection_callback: Callable | None = None
6570

6671
def reconnect(self):

src/murfey/util/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ class Security(BaseModel):
9797
feedback_queue: str = "murfey_feedback"
9898
graylog_host: str = ""
9999
graylog_port: Optional[int] = None
100+
ispyb_credentials: Optional[str] = None
100101

101102
@validator("graylog_port")
102103
def check_port_present_if_host_is(

0 commit comments

Comments
 (0)