Merge pull request #2470 from alexbelgium/codex/fix-automatic-config-generation-errors

Fallback to Home Assistant external/internal URL for NetBird domain
This commit is contained in:
Alexandre
2026-02-09 21:49:27 +01:00
committed by GitHub
2 changed files with 15 additions and 3 deletions

View File

@@ -16,7 +16,7 @@ NetBird relies on gRPC. The built-in Caddy configuration is pre-wired to proxy b
This add-on generates the standard quickstart configuration files in `/config/netbird` and reuses them on subsequent starts.
### Required options
- `domain`: Public domain that resolves to your Home Assistant host (e.g., `netbird.example.com`).
- `domain`: Public domain that resolves to your Home Assistant host (e.g., `netbird.example.com`). If left at the default placeholder, the add-on will try to use the host from Home Assistant's `external_url` or `internal_url` instead.
### Dashboard environment overrides
Edit `/config/netbird/dashboard/env` to configure the dashboard UI:

View File

@@ -33,8 +33,20 @@ SIGNAL_GRPC_PORT=10000
RELAY_PORT=8084
if [[ -z "$DOMAIN" || "$DOMAIN" == "netbird.example.com" ]]; then
bashio::log.error "Set a valid domain in the add-on configuration (domain cannot be empty or netbird.example.com)."
bashio::exit.nok
result=$(bashio::api.supervisor GET /core/api/config true || true)
external_host="$(bashio::jq "$result" '.external_url' | cut -d'/' -f3 | cut -d':' -f1)"
internal_host="$(bashio::jq "$result" '.internal_url' | cut -d'/' -f3 | cut -d':' -f1)"
if [[ -n "$external_host" && "$external_host" != "null" ]]; then
DOMAIN="$external_host"
bashio::log.warning "Domain not set; using Home Assistant external_url host: ${DOMAIN}"
elif [[ -n "$internal_host" && "$internal_host" != "null" ]]; then
DOMAIN="$internal_host"
bashio::log.warning "Domain not set; using Home Assistant internal_url host: ${DOMAIN}"
else
bashio::log.error "Set a valid domain in the add-on configuration (domain cannot be empty or netbird.example.com)."
bashio::exit.nok
fi
fi
NETBIRD_PORT=443