4343from murfey .util import sanitise_path
4444from murfey .util .config import (
4545 MachineConfig ,
46- from_file ,
4746 get_hostname ,
47+ machine_config_from_file ,
4848 security_from_file ,
4949)
5050from murfey .util .db import (
@@ -93,7 +93,9 @@ class Settings(BaseSettings):
9393machine_config : dict [str , MachineConfig ] = {}
9494if settings .murfey_machine_configuration :
9595 microscope = get_microscope ()
96- machine_config = from_file (Path (settings .murfey_machine_configuration ), microscope )
96+ machine_config = machine_config_from_file (
97+ Path (settings .murfey_machine_configuration ), microscope
98+ )
9799
98100
99101# This will be the homepage for a given microscope.
@@ -114,19 +116,19 @@ async def root(request: Request):
114116def machine_info () -> Optional [MachineConfig ]:
115117 instrument_name = os .getenv ("BEAMLINE" )
116118 if settings .murfey_machine_configuration and instrument_name :
117- return from_file ( Path ( settings . murfey_machine_configuration ), instrument_name )[
118- instrument_name
119- ]
119+ return machine_config_from_file (
120+ Path ( settings . murfey_machine_configuration ), instrument_name
121+ )[ instrument_name ]
120122 return None
121123
122124
123125@lru_cache (maxsize = 5 )
124126@router .get ("/instruments/{instrument_name}/machine" )
125127def machine_info_by_name (instrument_name : str ) -> Optional [MachineConfig ]:
126128 if settings .murfey_machine_configuration :
127- return from_file ( Path ( settings . murfey_machine_configuration ), instrument_name )[
128- instrument_name
129- ]
129+ return machine_config_from_file (
130+ Path ( settings . murfey_machine_configuration ), instrument_name
131+ )[ instrument_name ]
130132 return None
131133
132134
0 commit comments