start.sh 822 B

1234567891011121314151617181920212223
  1. #!/bin/bash
  2. set -eu
  3. mkdir -p /app/data/config
  4. export STNODEFAULTFOLDER=1 STNOUPGRADE=1
  5. # if this if the first run, generate a useful config
  6. if [ ! -f /app/data/config/config.xml ]; then
  7. echo "=> Generating config"
  8. /app/code/syncthing --generate="/app/data/config"
  9. fi
  10. # Set the listenAddress and the gui enabled to make sure user doesnt lock themselves out by accident.
  11. sed -e "s,<listenAddress>.*</listenAddress>,<listenAddress>tcp://:${SYNCER_PORT}</listenAddress>," -i /app/data/config/config.xml
  12. sed -e 's,<gui .*>,<gui enabled="true" tls="false" debugging="false">,' -i /app/data/config/config.xml
  13. chown -R cloudron:cloudron /app/data/config /app/data
  14. echo "=> Starting syncthing"
  15. exec /usr/local/bin/gosu cloudron:cloudron /app/code/syncthing -gui-address=0.0.0.0:3000 -home=/app/data/config -no-browser