mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-02 05:44:03 +02:00
Handle missing NetBird domain via HA URLs
This commit is contained in:
@@ -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.
|
This add-on generates the standard quickstart configuration files in `/config/netbird` and reuses them on subsequent starts.
|
||||||
|
|
||||||
### Required options
|
### 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
|
### Dashboard environment overrides
|
||||||
Edit `/config/netbird/dashboard/env` to configure the dashboard UI:
|
Edit `/config/netbird/dashboard/env` to configure the dashboard UI:
|
||||||
|
|||||||
@@ -33,8 +33,20 @@ SIGNAL_GRPC_PORT=10000
|
|||||||
RELAY_PORT=8084
|
RELAY_PORT=8084
|
||||||
|
|
||||||
if [[ -z "$DOMAIN" || "$DOMAIN" == "netbird.example.com" ]]; then
|
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)."
|
result=$(bashio::api.supervisor GET /core/api/config true || true)
|
||||||
bashio::exit.nok
|
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
|
fi
|
||||||
|
|
||||||
NETBIRD_PORT=443
|
NETBIRD_PORT=443
|
||||||
|
|||||||
Reference in New Issue
Block a user