system-config.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. config.focusUserJid = 'focus@{{$XMPP_AUTH_DOMAIN}}';
  19. {{ if $ENABLE_SUBDOMAINS -}}
  20. var subdir = '<!--# echo var="subdir" default="" -->';
  21. var subdomain = '<!--# echo var="subdomain" default="" -->';
  22. if (subdir.startsWith('<!--')) {
  23. subdir = '';
  24. }
  25. if (subdomain) {
  26. subdomain = subdomain.substring(0,subdomain.length-1).split('.').join('_').toLowerCase() + '.';
  27. }
  28. config.hosts.muc = '{{ $XMPP_MUC_DOMAIN_PREFIX }}.' + subdomain + '{{ $XMPP_DOMAIN }}';
  29. {{ else -}}
  30. config.hosts.muc = '{{ $XMPP_MUC_DOMAIN }}';
  31. {{ end -}}
  32. {{ if $ENABLE_AUTH -}}
  33. {{ if $ENABLE_GUESTS -}}
  34. // When using authentication, domain for guest users.
  35. config.hosts.anonymousdomain = '{{ $XMPP_GUEST_DOMAIN }}';
  36. {{ end -}}
  37. {{ if $ENABLE_AUTH_DOMAIN -}}
  38. // Domain for authenticated users. Defaults to <domain>.
  39. config.hosts.authdomain = '{{ $XMPP_DOMAIN }}';
  40. {{ end -}}
  41. {{ end -}}
  42. {{ if $BOSH_RELATIVE -}}
  43. {{ if $ENABLE_SUBDOMAINS -}}
  44. config.bosh = '/'+ subdir + 'http-bind';
  45. {{ else -}}
  46. config.bosh = '/http-bind';
  47. {{ end -}}
  48. {{ else -}}
  49. {{ if $ENABLE_SUBDOMAINS -}}
  50. config.bosh = 'https://{{ $PUBLIC_URL_DOMAIN}}/' + subdir + 'http-bind';
  51. {{ else -}}
  52. config.bosh = 'https://{{ $PUBLIC_URL_DOMAIN}}/http-bind';
  53. {{ end -}}
  54. {{ end -}}
  55. {{ if $ENABLE_XMPP_WEBSOCKET -}}
  56. {{ if $ENABLE_SUBDOMAINS -}}
  57. config.websocket = 'wss://{{ $PUBLIC_URL_DOMAIN }}/' + subdir + 'xmpp-websocket';
  58. {{ else -}}
  59. config.websocket = 'wss://{{ $PUBLIC_URL_DOMAIN }}/xmpp-websocket';
  60. {{ end -}}
  61. {{ end -}}
  62. config.bridgeChannel = {
  63. preferSctp: {{ $JVB_PREFER_SCTP }}
  64. };