entrypoint.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/sh
  2. # Generate configuration file with host-specific parameters
  3. cat << EOF > ~/env.yml
  4. define_macro:
  5. HOSTNAME: $HOSTNAME
  6. IP_ADDRESS: $IP_ADDRESS
  7. IRCDOMAIN:
  8. irc.$HOSTNAME:
  9. password: $IRCPASS
  10. WS_URL: "wss://$HOSTNAME:5443/ws"
  11. ACL_ORIGIN: "https://$HOSTNAME"
  12. PUT_URL: "https://$HOSTNAME:5443/upload"
  13. EOF
  14. cat ~/env.yml
  15. # Generate discovery file for XEP-0156 in XML format
  16. cat << EOF > ~/www/.well-known/host-meta
  17. <?xml version='1.0' encoding='utf-8'?>
  18. <XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>
  19. <Link rel="urn:xmpp:alt-connections:xbosh"
  20. href="https://$HOSTNAME:5443/bosh" />
  21. <Link rel="urn:xmpp:alt-connections:websocket"
  22. href="wss://$HOSTNAME:5443/ws" />
  23. </XRD>
  24. EOF
  25. # Generate discovery file for XEP-0156 in JSON format
  26. cat << EOF > ~/www/.well-known/host-meta.json
  27. {
  28. "links": [
  29. {
  30. "rel": "urn:xmpp:alt-connections:xbosh",
  31. "href": "https://$HOSTNAME:5443/bosh"
  32. },
  33. {
  34. "rel": "urn:xmpp:alt-connections:websocket",
  35. "href": "wss://$HOSTNAME:5443/ws"
  36. }
  37. ]
  38. }
  39. EOF
  40. # Run ejabberdctl as done in the original entrypoint from the dockerfile
  41. /home/ejabberd/bin/ejabberdctl "$@"