Skip to content

Commit

Permalink
[syncthing] Improve configuration
Browse files Browse the repository at this point in the history
Use environment variables instead of CLI arguments where possible and
properly separate config and database/state directories.
  • Loading branch information
salim-b committed Jan 1, 2024
1 parent 9bc93f7 commit c20f33d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
9 changes: 8 additions & 1 deletion syncthing/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ FROM $BUILD_FROM
RUN apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community \
"syncthing=1.25.0-r1"

COPY root /

ENV STCONFDIR=/config \
STDATADIR=/data \
STNODEFAULTFOLDER=1 \
STNORESTART=1 \
STNOUPGRADE=1

ENTRYPOINT [ "/init" ]
CMD []
COPY root /
16 changes: 7 additions & 9 deletions syncthing/root/etc/s6-overlay/s6-rc.d/syncthing/run
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@
# shellcheck shell=bash
set -e

export STNOUPGRADE=1

bashio::log.info 'Setup config'
mkdir -p /data/config
bashio::log.info 'Intializing Syncthing'

ip=$(ifconfig | grep "inet " | grep -Fv 127.0.0.1 | awk '{sub("addr:",""); print $2}' | head -n 1)

if [ -z "$ip" ]
then
ip=0.0.0.0
ip=0.0.0.0
bashio::log.info "Couldn't detect IP address. Falling back to: $ip"
else
bashio::log.info "Detected IP address: $ip"
fi

bashio::log.info "Detected IP Address: $ip"

bashio::log.info 'Start syncthing'
syncthing --no-browser --no-restart --home=/data/config --gui-address="$ip:8384"
bashio::log.info 'Starting Syncthing'
syncthing --gui-address="$ip:8384" --no-browser

0 comments on commit c20f33d

Please sign in to comment.