entrypoint.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 additional custom configuration
  16. echo > ~/custom.yml
  17. for config in ~/conf.custom/*.yml;
  18. do cat $config >> ~/custom.yml
  19. done
  20. # Generate discovery file for XEP-0156 in XML format
  21. cat << EOF > ~/www/.well-known/host-meta
  22. <?xml version='1.0' encoding='utf-8'?>
  23. <XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>
  24. <Link rel="urn:xmpp:alt-connections:xbosh"
  25. href="https://$HOSTNAME:5443/bosh" />
  26. <Link rel="urn:xmpp:alt-connections:websocket"
  27. href="wss://$HOSTNAME:5443/ws" />
  28. </XRD>
  29. EOF
  30. # Generate discovery file for XEP-0156 in JSON format
  31. cat << EOF > ~/www/.well-known/host-meta.json
  32. {
  33. "links": [
  34. {
  35. "rel": "urn:xmpp:alt-connections:xbosh",
  36. "href": "https://$HOSTNAME:5443/bosh"
  37. },
  38. {
  39. "rel": "urn:xmpp:alt-connections:websocket",
  40. "href": "wss://$HOSTNAME:5443/ws"
  41. }
  42. ]
  43. }
  44. EOF
  45. # Run ejabberdctl as done in the original entrypoint from the dockerfile
  46. /home/ejabberd/bin/ejabberdctl "$@"