system-config.js 2.3 KB

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