start.sh 923 B

123456789101112131415161718192021222324252627282930
  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. sed -e 's,<listenAddress>.*</listenAddress>,<listenAddress>tcp://:22000</listenAddress>,' -i /app/data/config/config.xml
  12. fi
  13. cat >/run/ldap.conf <<EOF
  14. ldap_server cloudron {
  15. url ${LDAP_URL}/${LDAP_USERS_BASE_DN}?username;
  16. binddn ${LDAP_BIND_DN};
  17. binddn_passwd ${LDAP_BIND_PASSWORD};
  18. group_attribute ${LDAP_GROUPS_BASE_DN};
  19. group_attribute_is_dn on;
  20. require valid_user;
  21. }
  22. EOF
  23. export STNODEFAULTFOLDER=1 STNOUPGRADE=1
  24. exec busybox init