2
0

system-config.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. {{ $BOSH_RELATIVE := .Env.BOSH_RELATIVE | default "false" | toBool -}}
  2. {{ $ENABLE_AUTH := .Env.ENABLE_AUTH | default "false" | toBool -}}
  3. {{ $ENABLE_AUTH_DOMAIN := .Env.ENABLE_AUTH_DOMAIN | default "true" | toBool -}}
  4. {{ $ENABLE_GUESTS := .Env.ENABLE_GUESTS | default "false" | toBool -}}
  5. {{ $ENABLE_SUBDOMAINS := .Env.ENABLE_SUBDOMAINS | default "true" | toBool -}}
  6. {{ $ENABLE_XMPP_WEBSOCKET := .Env.ENABLE_XMPP_WEBSOCKET | default "1" | toBool -}}
  7. {{ $PUBLIC_URL_DOMAIN := .Env.PUBLIC_URL | default "https://localhost:8443" | trimPrefix "https://" | trimSuffix "/" -}}
  8. {{ $XMPP_AUTH_DOMAIN := .Env.XMPP_AUTH_DOMAIN | default "auth.meet.jitsi" -}}
  9. {{ $XMPP_DOMAIN := .Env.XMPP_DOMAIN | default "meet.jitsi" -}}
  10. {{ $XMPP_GUEST_DOMAIN := .Env.XMPP_GUEST_DOMAIN | default "guest.meet.jitsi" -}}
  11. {{ $XMPP_MUC_DOMAIN := .Env.XMPP_MUC_DOMAIN | default "muc.meet.jitsi" -}}
  12. {{ $XMPP_MUC_DOMAIN_PREFIX := (split "." $XMPP_MUC_DOMAIN)._0 -}}
  13. {{ $JVB_PREFER_SCTP := .Env.JVB_PREFER_SCTP | default "1" | toBool -}}
  14. // Jitsi Meet configuration.
  15. var config = {};
  16. config.hosts = {};
  17. config.hosts.domain = '{{ $XMPP_DOMAIN }}';
  18. {{ if $ENABLE_SUBDOMAINS -}}
  19. var subdir = '<!--# echo var="subdir" default="" -->';
  20. var subdomain = '<!--# echo var="subdomain" default="" -->';
  21. if (subdir.startsWith('<!--')) {
  22. subdir = '';
  23. }
  24. if (subdomain) {
  25. subdomain = subdomain.substring(0,subdomain.length-1).split('.').join('_').toLowerCase() + '.';
  26. }
  27. config.hosts.muc = '{{ $XMPP_MUC_DOMAIN_PREFIX }}.' + subdomain + '{{ $XMPP_DOMAIN }}';
  28. {{ else -}}
  29. config.hosts.muc = '{{ $XMPP_MUC_DOMAIN }}';
  30. {{ end -}}
  31. {{ if $ENABLE_AUTH -}}
  32. {{ if $ENABLE_GUESTS -}}
  33. // When using authentication, domain for guest users.
  34. config.hosts.anonymousdomain = '{{ $XMPP_GUEST_DOMAIN }}';
  35. {{ end -}}
  36. {{ if $ENABLE_AUTH_DOMAIN -}}
  37. // Domain for authenticated users. Defaults to <domain>.
  38. config.hosts.authdomain = '{{ $XMPP_DOMAIN }}';
  39. {{ end -}}
  40. {{ end -}}
  41. {{ if $BOSH_RELATIVE -}}
  42. {{ if $ENABLE_SUBDOMAINS -}}
  43. config.bosh = '/'+ subdir + 'http-bind';
  44. {{ else -}}
  45. config.bosh = '/http-bind';
  46. {{ end -}}
  47. {{ else -}}
  48. {{ if $ENABLE_SUBDOMAINS -}}
  49. config.bosh = 'https://{{ $PUBLIC_URL_DOMAIN}}/' + subdir + 'http-bind';
  50. {{ else -}}
  51. config.bosh = 'https://{{ $PUBLIC_URL_DOMAIN}}/http-bind';
  52. {{ end -}}
  53. {{ end -}}
  54. {{ if $ENABLE_XMPP_WEBSOCKET -}}
  55. {{ if $ENABLE_SUBDOMAINS -}}
  56. config.websocket = 'wss://{{ $PUBLIC_URL_DOMAIN }}/' + subdir + 'xmpp-websocket';
  57. {{ else -}}
  58. config.websocket = 'wss://{{ $PUBLIC_URL_DOMAIN }}/xmpp-websocket';
  59. {{ end -}}
  60. {{ end -}}
  61. config.bridgeChannel = {
  62. preferSctp: {{ $JVB_PREFER_SCTP }}
  63. };