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