start.sh 941 B

123456789101112131415161718192021222324252627282930313233
  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. cat >/run/ldap.conf <<EOF
  11. ldap_server cloudron {
  12. url ${LDAP_URL}/${LDAP_USERS_BASE_DN}?username;
  13. binddn ${LDAP_BIND_DN};
  14. binddn_passwd ${LDAP_BIND_PASSWORD};
  15. group_attribute ${LDAP_GROUPS_BASE_DN};
  16. group_attribute_is_dn on;
  17. require valid_user;
  18. }
  19. EOF
  20. # Set the listenAddress and the gui enabled to make sure user doesnt lock themselves out by accident.
  21. sed -e 's,<listenAddress>.*</listenAddress>,<listenAddress>tcp://:22000</listenAddress>,' -i /app/data/config/config.xml
  22. sed -e 's,<gui .*>,<gui enabled="true" tls="false" debugging="false">,' -i /app/data/config/config.xml
  23. chown -R cloudron:cloudron /app/data/config /app/data
  24. exec busybox init