fix: move sub2api runtime to PK01 host docker
This commit is contained in:
@@ -436,8 +436,32 @@ def desired_manual_proxy_payload(protection):
|
||||
if not isinstance(binding, dict) or binding.get("enabled") is not True:
|
||||
return None
|
||||
plan = manual_binding_plan(binding, "proxy")
|
||||
if plan.get("provider") != "target-egress-proxy":
|
||||
if plan.get("provider") not in ("target-egress-proxy", "fixed-http-proxy"):
|
||||
raise RuntimeError(f"manual account proxyBinding source {plan.get('id')} uses unsupported provider {plan.get('provider')}")
|
||||
if plan.get("provider") == "fixed-http-proxy":
|
||||
fixed_proxy = plan.get("fixedProxy")
|
||||
if not isinstance(fixed_proxy, dict):
|
||||
raise RuntimeError(f"manual account proxyBinding source {plan.get('id')} requires fixedProxy")
|
||||
proxy_name = binding.get("proxyName")
|
||||
protocol = fixed_proxy.get("protocol")
|
||||
host = fixed_proxy.get("host")
|
||||
port = fixed_proxy.get("port")
|
||||
if not isinstance(proxy_name, str) or not proxy_name:
|
||||
raise RuntimeError("manual account proxyBinding proxyName is missing")
|
||||
if protocol != "http":
|
||||
raise RuntimeError("fixed proxy protocol must be http")
|
||||
if not isinstance(host, str) or not host:
|
||||
raise RuntimeError("fixed proxy host is missing")
|
||||
if not isinstance(port, int) or port <= 0:
|
||||
raise RuntimeError("fixed proxy port is missing")
|
||||
return {
|
||||
"name": proxy_name,
|
||||
"protocol": protocol,
|
||||
"host": host,
|
||||
"port": port,
|
||||
"fallback_mode": "none",
|
||||
"expiry_warn_days": 0,
|
||||
}
|
||||
target_proxy = plan.get("targetEgressProxy")
|
||||
if not isinstance(target_proxy, dict):
|
||||
raise RuntimeError(f"manual account proxyBinding source {plan.get('id')} requires an enabled target egressProxy")
|
||||
|
||||
Reference in New Issue
Block a user