From 17d8d93d1159c916fdd4d51520bf343d2d838096 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sun, 27 Aug 2023 17:13:58 +0100 Subject: [PATCH] syncthing/run: Set gui-address to first IP in container https://github.com/Poeschl/Hassio-Addons/issues/340 --- syncthing/CHANGELOG.md | 4 ++++ syncthing/root/etc/s6-overlay/s6-rc.d/syncthing/run | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/syncthing/CHANGELOG.md b/syncthing/CHANGELOG.md index 13edfe5b..4ac77d23 100644 --- a/syncthing/CHANGELOG.md +++ b/syncthing/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.xx.x - 2023-xx-xx + +* 🔨Set gui-address to first IP in container (#426) + ## 1.16.3 - 2023-07-20 * 🔼 Updated syncthing to `1.23.6-r1` (thanks @salim-b | #394) diff --git a/syncthing/root/etc/s6-overlay/s6-rc.d/syncthing/run b/syncthing/root/etc/s6-overlay/s6-rc.d/syncthing/run index 3d97ca54..9999ba64 100644 --- a/syncthing/root/etc/s6-overlay/s6-rc.d/syncthing/run +++ b/syncthing/root/etc/s6-overlay/s6-rc.d/syncthing/run @@ -7,5 +7,14 @@ export STNOUPGRADE=1 bashio::log.info 'Setup config' mkdir -p /data/config +ip=$(ifconfig | grep "inet " | grep -Fv 127.0.0.1 | awk '{print $2}' | head -n 1) + +if [ -z "$ip" ] +then + ip=0.0.0.0 +fi + +bashio::log.info "IP Address: $ip" + bashio::log.info 'Start syncthing' -syncthing --no-browser --no-restart --home=/data/config --gui-address=0.0.0.0:8384 +syncthing --no-browser --no-restart --home=/data/config --gui-address="$ip:8384"