Skip to content

Commit d849fd1

Browse files
committed
Merged recent changes from 'main' branch
2 parents d66c453 + 88a6f93 commit d849fd1

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ Bug-Tracker = "https://github.com/DiamondLightSource/python-murfey/issues"
8080
Documentation = "https://github.com/DiamondLightSource/python-murfey"
8181
GitHub = "https://github.com/DiamondLightSource/python-murfey"
8282
[project.scripts]
83-
murfey = "murfey.client:run"
8483
"murfey.add_user" = "murfey.cli.add_user:run"
84+
"murfey.client" = "murfey.client:run"
8585
"murfey.create_db" = "murfey.cli.create_db:run"
8686
"murfey.db_sql" = "murfey.cli.murfey_db_sql:run"
8787
"murfey.decrypt_password" = "murfey.cli.decrypt_db_password:run"

src/murfey/instrument_server/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import argparse
22
import logging
3+
from urllib.parse import urlparse
34

45
import uvicorn
56
from rich.logging import RichHandler
67

78
import murfey
9+
import murfey.client.update
810
from murfey.client.customlogging import CustomHandler
911
from murfey.util import LogFilter
1012
from murfey.util.client import read_config
@@ -27,6 +29,12 @@ def run():
2729
)
2830
args = parser.parse_args()
2931

32+
murfey_url = urlparse(read_config()["Murfey"].get("server"), allow_fragments=False)
33+
try:
34+
murfey.client.update.check(murfey_url)
35+
except Exception as e:
36+
print(f"Murfey update check failed with {e}")
37+
3038
LogFilter.install()
3139

3240
rich_handler = RichHandler(enable_link_path=False)

src/murfey/server/api/auth.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22

3-
import os
43
import secrets
54
import time
65
from logging import getLogger
@@ -19,7 +18,7 @@
1918

2019
from murfey.server import sanitise
2120
from murfey.server.murfey_db import murfey_db, url
22-
from murfey.util.config import get_machine_config, get_security_config
21+
from murfey.util.config import get_security_config
2322
from murfey.util.db import MurfeyUser as User
2423
from murfey.util.db import Session as MurfeySession
2524

@@ -64,12 +63,7 @@ async def __call__(self, request: Request):
6463

6564
# Set up variables used for authentication
6665
security_config = get_security_config()
67-
machine_config = get_machine_config()
68-
auth_url = (
69-
machine_config[os.getenv("BEAMLINE", "")].auth_url
70-
if machine_config.get(os.getenv("BEAMLINE", ""))
71-
else ""
72-
)
66+
auth_url = security_config.auth_url
7367
ALGORITHM = security_config.auth_algorithm or "HS256"
7468
SECRET_KEY = security_config.auth_key or secrets.token_hex(32)
7569
if security_config.auth_type == "password":

src/murfey/util/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ class MachineConfig(BaseModel, extra=Extra.allow): # type: ignore
6868
rsync_url: str = ""
6969

7070
security_configuration_path: Optional[Path] = None
71-
auth_url: str = ""
7271

7372
notifications_queue: str = "pato_notification"
7473

@@ -88,6 +87,7 @@ class Security(BaseModel):
8887
crypto_key: str
8988
auth_key: str = ""
9089
auth_algorithm: str = ""
90+
auth_url: str = ""
9191
sqlalchemy_pooling: bool = True
9292
allow_origins: List[str] = ["*"]
9393
session_validation: str = ""

0 commit comments

Comments
 (0)