added proxy configuration to haos addon config ui

This commit is contained in:
macm1
2026-02-22 19:54:51 +03:00
parent c3ba720d0b
commit ab33e6702f
8 changed files with 44 additions and 1 deletions
+15
View File
@@ -20,6 +20,7 @@ fi
TZNAME=$(jq -r '.timezone // "Europe/Sofia"' "$OPTIONS_FILE")
GW_PUBLIC_URL=$(jq -r '.gateway_public_url // empty' "$OPTIONS_FILE")
HA_TOKEN=$(jq -r '.homeassistant_token // empty' "$OPTIONS_FILE")
ADDON_HTTP_PROXY=$(jq -r '.http_proxy // empty' "$OPTIONS_FILE")
ENABLE_TERMINAL=$(jq -r '.enable_terminal // true' "$OPTIONS_FILE")
TERMINAL_PORT_RAW=$(jq -r '.terminal_port // 7681' "$OPTIONS_FILE")
@@ -57,6 +58,20 @@ export TZ="$TZNAME"
# Reduce risk of secrets ending up in logs
set +x
# Optional outbound proxy from add-on settings.
# If set, apply it to both HTTP and HTTPS for Node/undici/OpenClaw tooling.
if [ -n "$ADDON_HTTP_PROXY" ]; then
if [[ "$ADDON_HTTP_PROXY" =~ ^https?://[^[:space:]]+$ ]]; then
export HTTP_PROXY="$ADDON_HTTP_PROXY"
export HTTPS_PROXY="$ADDON_HTTP_PROXY"
export http_proxy="$ADDON_HTTP_PROXY"
export https_proxy="$ADDON_HTTP_PROXY"
echo "INFO: Outbound HTTP/HTTPS proxy enabled from add-on configuration."
else
echo "WARN: Invalid http_proxy value in add-on options; expected URL like http://host:port"
fi
fi
# Optional network hardening/workaround: force IPv4-first DNS ordering for Node.js.
# Helps in environments where IPv6 resolves but has no working egress.
if [ "$FORCE_IPV4_DNS" = "true" ] || [ "$FORCE_IPV4_DNS" = "1" ]; then