From 1f9947bc8bc4ddff87e8812f9a5c9f9c96008ea5 Mon Sep 17 00:00:00 2001 From: yxd92326 Date: Fri, 2 May 2025 14:07:58 +0100 Subject: [PATCH 1/2] Run updates on instrument server startup --- src/murfey/instrument_server/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/murfey/instrument_server/__init__.py b/src/murfey/instrument_server/__init__.py index be0fc49fc..e6316a41a 100644 --- a/src/murfey/instrument_server/__init__.py +++ b/src/murfey/instrument_server/__init__.py @@ -1,10 +1,12 @@ import argparse import logging +from urllib.parse import urlparse import uvicorn from rich.logging import RichHandler import murfey +import murfey.client.update from murfey.client.customlogging import CustomHandler from murfey.util import LogFilter from murfey.util.client import read_config @@ -27,6 +29,12 @@ def run(): ) args = parser.parse_args() + murfey_url = urlparse(read_config()["Murfey"].get("server"), allow_fragments=False) + try: + murfey.client.update.check(murfey_url) + except Exception as e: + print(f"Murfey update check failed with {e}") + LogFilter.install() rich_handler = RichHandler(enable_link_path=False) From 5aa9d2f57c80be07722699e237c3f6bcaaa34a04 Mon Sep 17 00:00:00 2001 From: yxd92326 Date: Fri, 2 May 2025 14:08:56 +0100 Subject: [PATCH 2/2] Only start client if specifically requested --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e3ac0eb87..40a6508ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -80,8 +80,8 @@ Bug-Tracker = "https://github.com/DiamondLightSource/python-murfey/issues" Documentation = "https://github.com/DiamondLightSource/python-murfey" GitHub = "https://github.com/DiamondLightSource/python-murfey" [project.scripts] -murfey = "murfey.client:run" "murfey.add_user" = "murfey.cli.add_user:run" +"murfey.client" = "murfey.client:run" "murfey.create_db" = "murfey.cli.create_db:run" "murfey.db_sql" = "murfey.cli.murfey_db_sql:run" "murfey.decrypt_password" = "murfey.cli.decrypt_db_password:run"