start.sh 1.1 KB

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