5959from pathlib import Path , PurePath
6060import sys
6161from textwrap import dedent
62- from typing import List
62+ from typing import List , Optional
6363
6464from pkg_resources import parse_version
6565from tornado import ioloop
@@ -145,15 +145,6 @@ class CylcUIServer(ExtensionApp):
145145 cylc gui --no-browser # Start the server but don't open the browser
146146
147147 ''' ) # type: ignore[assignment]
148- config_file_paths = get_conf_dir_hierarchy (
149- [
150- SITE_CONF_ROOT , # site configuration
151- USER_CONF_ROOT , # user configuration
152- ], filename = False
153- )
154- # Next include currently needed for directory making
155- config_file_paths .insert (0 , str (Path (uis_pkg ).parent )) # packaged config
156- config_file_paths .reverse ()
157148 # TODO: Add a link to the access group table mappings in cylc documentation
158149 # https://github.com/cylc/cylc-uiserver/issues/466
159150 AUTH_DESCRIPTION = '''
@@ -405,6 +396,7 @@ def _get_ui_path(self):
405396
406397 def __init__ (self , * args , ** kwargs ):
407398 super ().__init__ (* args , ** kwargs )
399+ self ._config_file_paths : Optional [List [str ]] = None
408400 self .executor = ProcessPoolExecutor (max_workers = self .max_workers )
409401 self .workflows_mgr = WorkflowsManager (self , log = self .log )
410402 self .data_store_mgr = DataStoreMgr (
@@ -421,6 +413,21 @@ def __init__(self, *args, **kwargs):
421413 workflows_mgr = self .workflows_mgr ,
422414 )
423415
416+ @property
417+ def config_file_paths (self ) -> List [str ]:
418+ if self ._config_file_paths is None :
419+ ret = get_conf_dir_hierarchy (
420+ [
421+ SITE_CONF_ROOT , # site configuration
422+ USER_CONF_ROOT , # user configuration
423+ ], filename = False
424+ )
425+ # Next include currently needed for directory making
426+ ret .insert (0 , str (Path (uis_pkg ).parent )) # packaged config
427+ ret .reverse ()
428+ self ._config_file_paths = ret
429+ return self ._config_file_paths
430+
424431 def initialize_settings (self ):
425432 """Update extension settings.
426433
0 commit comments