refac
This commit is contained in:
1 parent
9a772f42c8
commit
09d4cccb79
1 file changed
+3
-4
@@ -6,12 +6,11 @@ from urllib.parse import quote
|
|||||||
def get_terminal_server_url(connection: dict) -> str:
|
def get_terminal_server_url(connection: dict) -> str:
|
||||||
"""Return the upstream base URL for a terminal connection.
|
"""Return the upstream base URL for a terminal connection.
|
||||||
|
|
||||||
Only orchestrator connections with an explicit policy use the named-policy
|
An explicit policy uses the named-policy route. Connections without one
|
||||||
route. Direct Open Terminal connections and legacy unscoped orchestrator
|
keep their existing root route.
|
||||||
connections keep their existing root route.
|
|
||||||
"""
|
"""
|
||||||
base_url = str(connection.get('url') or '').rstrip('/')
|
base_url = str(connection.get('url') or '').rstrip('/')
|
||||||
policy_id = str(connection.get('policy_id') or '').strip()
|
policy_id = str(connection.get('policy_id') or '').strip()
|
||||||
if connection.get('server_type') == 'orchestrator' and policy_id:
|
if policy_id:
|
||||||
return f'{base_url}/p/{quote(policy_id, safe="")}'
|
return f'{base_url}/p/{quote(policy_id, safe="")}'
|
||||||
return base_url
|
return base_url
|
||||||
Reference in new issue
Block a user