start.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/bash
  2. set -eu
  3. mkdir -p /app/data/config
  4. # if this if the first run, generate a useful config
  5. if [ ! -f /app/data/config/config.xml ]; then
  6. echo "=> Generating config"
  7. /app/code/syncthing --generate="/app/data/config"
  8. # don't take the whole volume with the default so that we can add additional folders
  9. sed -i "s/path=\"\/root\/Sync\/\" /path=\"\/app\/data\/default\/\"/g" /app/data/config/config.xml
  10. fi
  11. cat >/run/ldap.conf <<EOF
  12. ldap_server cloudron {
  13. url ${LDAP_URL}/${LDAP_USERS_BASE_DN}?username;
  14. binddn ${LDAP_BIND_DN};
  15. binddn_passwd ${LDAP_BIND_PASSWORD};
  16. group_attribute ${LDAP_GROUPS_BASE_DN};
  17. group_attribute_is_dn on;
  18. require valid_user;
  19. }
  20. EOF
  21. # Set the listenAddress and the gui enabled to make sure user doesnt lock themselves out by accident.
  22. sed -e 's,<listenAddress>.*</listenAddress>,<listenAddress>tcp://:22000</listenAddress>,' -i /app/data/config/config.xml
  23. sed -e 's,<gui .*>,<gui enabled="true" tls="false" debugging="false">,' -i /app/data/config/config.xml
  24. chown -R cloudron:cloudron /app/data/config /app/data
  25. export STNODEFAULTFOLDER=1 STNOUPGRADE=1
  26. exec busybox init