2626class Settings (BaseSettings ):
2727 project_path : Path = Path ("examples/sushi" )
2828 config : str = ""
29+ gateway : str = ""
2930
3031
3132@lru_cache ()
@@ -34,10 +35,10 @@ def get_settings() -> Settings:
3435
3536
3637@lru_cache ()
37- def _get_context (path : str | Path , config : str ) -> Context :
38+ def _get_context (path : str | Path , config : str , gateway : str ) -> Context :
3839 from web .server .main import api_console
3940
40- return Context (paths = str (path ), config = config , console = api_console , load = False )
41+ return Context (paths = str (path ), config = config , console = api_console , gateway = gateway , load = False )
4142
4243
4344@lru_cache ()
@@ -56,8 +57,9 @@ def _get_path_mappings(context: Context) -> dict[Path, FileType]:
5657
5758
5859@lru_cache ()
59- def _get_loaded_context (path : str | Path , config : str ) -> Context :
60- context = _get_context (path , config )
60+ def _get_loaded_context (path : str | Path , config : str , gateway : str ) -> Context :
61+ print (config )
62+ context = _get_context (path , config , gateway )
6163 context .load ()
6264 return context
6365
@@ -93,7 +95,11 @@ async def get_loaded_context(settings: Settings = Depends(get_settings)) -> Cont
9395 try :
9496 async with get_context_lock :
9597 return await loop .run_in_executor (
96- None , _get_loaded_context , settings .project_path , settings .config
98+ None ,
99+ _get_loaded_context ,
100+ settings .project_path ,
101+ settings .config ,
102+ settings .gateway ,
97103 )
98104 except Exception :
99105 raise ApiException (
@@ -105,7 +111,7 @@ async def get_loaded_context(settings: Settings = Depends(get_settings)) -> Cont
105111async def get_context (settings : Settings = Depends (get_settings )) -> Context :
106112 try :
107113 async with get_context_lock :
108- return _get_context (settings .project_path , settings .config )
114+ return _get_context (settings .project_path , settings .config , settings . gateway )
109115 except Exception :
110116 raise ApiException (
111117 message = "Unable to create a context" ,
0 commit comments