2
0

system-config.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. {{ if $ENABLE_SUBDOMAINS -}}
  39. config.bosh = '/' + subdir + 'http-bind';
  40. {{ else -}}
  41. config.bosh = '/http-bind';
  42. {{ end -}}
  43. {{ if $ENABLE_XMPP_WEBSOCKET -}}
  44. {{ if $ENABLE_SUBDOMAINS -}}
  45. config.websocket = 'wss://{{ $PUBLIC_URL_DOMAIN }}/' + subdir + 'xmpp-websocket';
  46. {{ else -}}
  47. config.websocket = 'wss://{{ $PUBLIC_URL_DOMAIN }}/xmpp-websocket';
  48. {{ end -}}
  49. {{ if .Env.WEBSOCKET_KEEPALIVE_URL -}}
  50. config.websocketKeepAliveUrl = '{{ .Env.WEBSOCKET_KEEPALIVE_URL }}';
  51. {{ end -}}
  52. {{ end -}}
  53. {{ if $CONFIG_EXTERNAL_CONNECT -}}
  54. {{ if $ENABLE_SUBDOMAINS -}}
  55. config.externalConnectUrl = '/' + subdir + 'http-pre-bind';
  56. {{ else -}}
  57. config.externalConnectUrl = '/http-pre-bind';
  58. {{ end -}}
  59. {{ end -}}