added statement when IP is in local network
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
HOMEASSISTANT_DOMAIN="https://$DOMAIN";
|
||||
|
||||
if [ "$DOMAIN" == "localhost" ]; then
|
||||
|
||||
SELECTOR=$HOMEASSISTANT
|
||||
HOMEASSISTANT_IP=$(hostname -i | awk '{print $1}')
|
||||
HOST_FILE=/etc/system/data/dns/hosts.local;
|
||||
@@ -14,6 +17,7 @@ if [ -n "$EXISTS" ]; then
|
||||
else
|
||||
echo "$HOMEASSISTANT_IP $SELECTOR" >> $HOST_FILE
|
||||
fi
|
||||
fi
|
||||
|
||||
mkdir -p /etc/user/data/homeassistant/config
|
||||
|
||||
@@ -22,13 +26,16 @@ if [ ! -f /etc/user/data/homeassistant/config/configuration.yaml ]; then
|
||||
echo '# Loads default set of integrations. Do not remove.
|
||||
default_config:
|
||||
homeassistant:
|
||||
external_url: "http://localhost"
|
||||
external_url: "'$HOMEASSISTANT_DOMAIN'"
|
||||
http:
|
||||
use_x_forwarded_for: true
|
||||
trusted_proxies:
|
||||
- 172.18.104.2
|
||||
- 172.18.105.2' >/etc/user/data/homeassistant/config/configuration.yaml
|
||||
trusted_proxies:' >/etc/user/data/homeassistant/config/configuration.yaml
|
||||
|
||||
PROXIES=$(grep -w smarthostbackend $HOST_FILE| awk '{print $1}')
|
||||
|
||||
for PROXY in $(echo $PROXIES) ; do
|
||||
echo " - '$PROXY'" >>/etc/user/data/homeassistant/config/configuration.yaml
|
||||
done
|
||||
fi
|
||||
|
||||
yq eval '.homeassistant.external_url = "'$HOMEASSISTANT_DOMAIN'"' -i /etc/user/data/homeassistant/config/configuration.yaml
|
||||
|
Reference in New Issue
Block a user