entrypoint.sh 690 B

1234567891011121314151617181920
  1. #!/bin/sh
  2. set -euo pipefail
  3. # Patch config file
  4. echo "Patching config file..."
  5. cd /usr/share/nginx/html/
  6. if [ ! -z "$SALTYRTC_HOST" ]; then
  7. sed -i -E "s/SALTYRTC_HOST:\s*null,/SALTYRTC_HOST:'${SALTYRTC_HOST}',/g" *.bundle.js
  8. fi
  9. sed -i -E "s/SALTYRTC_PORT:\s*[^,]*,/SALTYRTC_PORT:${SALTYRTC_PORT},/g" *.bundle.js
  10. sed -i -E "s/SALTYRTC_SERVER_KEY:\s*\"[^\"]*\",/SALTYRTC_SERVER_KEY:\"${SALTYRTC_SERVER_KEY}\",/g" *.bundle.js
  11. # Add nginx mime type for wasm
  12. # See https://trac.nginx.org/nginx/ticket/1606
  13. if ! grep -q application/wasm "/etc/nginx/mime.types"; then
  14. sed -i '2aapplication/wasm wasm;' /etc/nginx/mime.types
  15. fi
  16. echo "Starting Threema Web..."
  17. exec nginx -g 'daemon off;'