Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion syncthing/DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ To permanently hold your data, synced folders must be put under one of the follo
| `/addons` | Local Home Assistant add-ons. |
| `/backups` | Home Assistant backups. |
| `/config` | Syncthing's own configuration. |
| `/data` | Syncthing's own internal data (state). Not recommended to store synced folders. |
| `/data` | Syncthing's own internal data (state). Not recommended to store synced folders (unless the configuration option `state_dir` points to a different path). |
| `/homeassistant` | Home Assistant's own configuration. |
| **`/media`** | Media files to be shared between add-ons and Home Assistant. See below for a possible way to automatically mount external storage devices under this path. |
| ***`/share`*** | Data to be shared between add-ons and Home Assistant. This is the default path for synced folders. |
Expand Down
6 changes: 2 additions & 4 deletions syncthing/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ arch:
homeassistant: 0.115.0
image: ghcr.io/poeschl-homeassistant-addons/syncthing-{arch}
init: false
schema:
state_dir: "str?"
ports:
8384/tcp: null
22000/tcp: 22000
21027/udp: 21027
ports_description:
8384/tcp: Web frontend (not needed with Ingress)
22000/tcp: Sync protocol
21027/udp: Discovery broadcast
ingress: true
ingress_port: 8384
panel_title: Syncthing
Expand Down
14 changes: 13 additions & 1 deletion syncthing/root/etc/s6-overlay/s6-rc.d/syncthing/run
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/command/with-contenv bashio
# shellcheck shell=bash
set -e
set -euo pipefail

bashio::log.info 'Intializing Syncthing'

Expand All @@ -25,5 +25,17 @@ then
mv -fn /data/config/* /data/ && rm -rf /data/config
fi

# set Syncthing state dir to user-defined value if indicated
if bashio::config.has_value 'state_dir'
then
STDATADIR="$(bashio::config 'state_dir')"
if [ ! -d "${STDATADIR}" ]
then
mkdir -p "${STDATADIR}"
fi
bashio::log.info "Setting Syncthing state directory to ${STDATADIR}"
export STDATADIR
fi

bashio::log.info 'Starting Syncthing'
syncthing --gui-address="$ip:8384" --no-browser
8 changes: 8 additions & 0 deletions syncthing/translations/en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
configuration:
state_dir:
name: State directory
description: Absolute path to the directory to store Syncthing's internal state. Defaults to `/data` if unset.
network:
8384/tcp: Web frontend (not needed with Ingress)
22000/tcp: Sync protocol
21027/udp: Discovery broadcast