File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,12 +65,6 @@ def initialise(app: Litestar):
6565 if settings ['MAP_VIEWER' ]:
6666 if not os .path .exists (settings ['FLATMAP_VIEWER' ]):
6767 exit (f'Missing { settings ["FLATMAP_VIEWER" ]} directory -- set FLATMAP_VIEWER environment variable to the full path' )
68- try :
69- with open (Path (settings ['FLATMAP_VIEWER' ]) / 'package.json' ) as fp :
70- package_json = json .load (fp )
71- except :
72- exit (f'Cannot read `package.json` in of standalone viewer in { settings ["FLATMAP_VIEWER" ]} ' )
73- settings ['VIEWER_VERSION' ] = package_json ['version' ]
7468
7569 settings ['LOGGER' ] = logger = logging .getLogger ('litestar' )
7670 logger .info (f'Starting flatmap server version { __version__ } ' )
@@ -104,10 +98,15 @@ async def version() -> list[dict]:
10498 versions = [
10599 {'id' : 'server' , 'version' : __version__ },
106100 ]
107- if (viewer_version := settings .get ('VIEWER_VERSION' )) is not None :
108- versions .append (
109- {'id' : 'viewer' , 'version' : viewer_version },
110- )
101+ if settings ['MAP_VIEWER' ]:
102+ try :
103+ with open (Path (settings ['FLATMAP_VIEWER' ]) / 'package.json' ) as fp :
104+ package_json = json .load (fp )
105+ versions .append (
106+ {'id' : 'viewer' , 'version' : package_json ['version' ]},
107+ )
108+ except :
109+ settings ['LOGGER' ].error (f'Cannot read `package.json` in of standalone viewer in { settings ["FLATMAP_VIEWER" ]} ' )
111110 return versions
112111
113112#===============================================================================
You can’t perform that action at this time.
0 commit comments