77
88from jumpstarter .client import client_from_path
99from jumpstarter .config .client import _allow_from_env
10- from jumpstarter .config .env import JMP_DRIVERS_ALLOW , JUMPSTARTER_HOST
10+ from jumpstarter .config .env import JMP_DRIVERS_ALLOW , JMP_USE_ALTERNATIVE_ENDPOINTS , JUMPSTARTER_HOST
1111from jumpstarter .driver import Driver
1212from jumpstarter .exporter import Session
1313
@@ -52,7 +52,16 @@ async def env_async(portal, stack):
5252
5353 allow , unsafe = _allow_from_env ()
5454
55- async with client_from_path (host , portal , stack , allow = allow , unsafe = unsafe ) as client :
55+ use_alternative_endpoints = os .environ .get (JMP_USE_ALTERNATIVE_ENDPOINTS , "0" ) == "1"
56+
57+ async with client_from_path (
58+ host ,
59+ portal ,
60+ stack ,
61+ allow = allow ,
62+ unsafe = unsafe ,
63+ use_alternative_endpoints = use_alternative_endpoints ,
64+ ) as client :
5665 try :
5766 yield client
5867 finally :
@@ -80,7 +89,13 @@ def env():
8089PROMPT_CWD = "\\ W"
8190
8291
83- def launch_shell (host : str , context : str , allow : list [str ], unsafe : bool ) -> int :
92+ def launch_shell (
93+ host : str ,
94+ context : str ,
95+ allow : list [str ],
96+ unsafe : bool ,
97+ use_alternative_endpoints : bool ,
98+ ) -> int :
8499 """Launch a shell with a custom prompt indicating the exporter type.
85100
86101 Args:
@@ -98,6 +113,7 @@ def launch_shell(host: str, context: str, allow: list[str], unsafe: bool) -> int
98113 | {
99114 JUMPSTARTER_HOST : host ,
100115 JMP_DRIVERS_ALLOW : "UNSAFE" if unsafe else "," .join (allow ),
116+ JMP_USE_ALTERNATIVE_ENDPOINTS : "1" if use_alternative_endpoints else "0" ,
101117 "PS1" : f"{ ANSI_GRAY } { PROMPT_CWD } { ANSI_YELLOW } ⚡{ ANSI_WHITE } { context } { ANSI_YELLOW } ➤{ ANSI_RESET } " ,
102118 },
103119 )
0 commit comments