feat: add HTTP/HTTPS proxy configuration via CLI args and settings file

- New CLI args: --http-proxy, --https-proxy, --no-proxy
- Falls back to comfy.settings.json keys: Comfy.Network.Proxy.HttpUrl,
  Comfy.Network.Proxy.HttpsUrl, Comfy.Network.Proxy.NoProxy
- Priority: CLI args override all; settings file fills gaps only
  (existing env vars take precedence over settings file)
- Credentials are redacted in startup logs via netloc-split approach
  (safe against malformed ports and empty-username/non-empty-password)
- Specific exception handling (OSError, JSONDecodeError) with warning log
This commit is contained in:
snomiao
2026-04-29 09:00:49 +09:00
parent fce0398470
commit 1e0e1fdfc2
2 changed files with 83 additions and 2 deletions

View File

@@ -233,6 +233,13 @@ parser.add_argument(
help="Set the base URL for the ComfyUI API. (default: https://api.comfy.org)",
)
parser.add_argument("--http-proxy", type=str, default=None, metavar="URL",
help="HTTP/HTTPS proxy URL (e.g. http://127.0.0.1:7890). Sets HTTP_PROXY and HTTPS_PROXY environment variables so all outbound traffic is routed through the proxy.")
parser.add_argument("--https-proxy", type=str, default=None, metavar="URL",
help="HTTPS proxy URL. If not set, --http-proxy is used for both HTTP and HTTPS traffic.")
parser.add_argument("--no-proxy", type=str, default=None, metavar="HOSTS",
help="Comma-separated list of hosts that should bypass the proxy (e.g. localhost,127.0.0.1,*.local).")
database_default_path = os.path.abspath(
os.path.join(os.path.dirname(__file__), "..", "user", "comfyui.db")
)