system-config.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. {{ $JICOFO_AUTH_USER := .Env.JICOFO_AUTH_USER | default "focus" -}}
  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. // Jitsi Meet configuration.
  14. var config = {};
  15. if (!config.hasOwnProperty('hosts')) config.hosts = {};
  16. config.hosts.domain = '{{ $XMPP_DOMAIN }}';
  17. config.focusUserJid = '{{$JICOFO_AUTH_USER}}@{{$XMPP_AUTH_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.substr(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. // Domain for authenticated users. Defaults to <domain>.
  37. config.hosts.authdomain = '{{ $XMPP_DOMAIN }}';
  38. {{ end -}}
  39. {{ if $ENABLE_SUBDOMAINS -}}
  40. config.bosh = '/' + subdir + 'http-bind';
  41. {{ else -}}
  42. config.bosh = '/http-bind';
  43. {{ end -}}
  44. {{ if $ENABLE_XMPP_WEBSOCKET -}}
  45. {{ if $ENABLE_SUBDOMAINS -}}
  46. config.websocket = 'wss://{{ $PUBLIC_URL_DOMAIN }}/' + subdir + 'xmpp-websocket';
  47. {{ else -}}
  48. config.websocket = 'wss://{{ $PUBLIC_URL_DOMAIN }}/xmpp-websocket';
  49. {{ end -}}
  50. {{ end -}}
  51. {{ if $CONFIG_EXTERNAL_CONNECT -}}
  52. {{ if $ENABLE_SUBDOMAINS -}}
  53. config.externalConnectUrl = '/' + subdir + 'http-pre-bind';
  54. {{ else -}}
  55. config.externalConnectUrl = '/http-pre-bind';
  56. {{ end -}}
  57. {{ end -}}