system-config.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 subdomain = "<!--# echo var="subdomain" default="" -->";
  20. if (subdomain) {
  21. subdomain = subdomain.substr(0,subdomain.length-1).split('.').join('_').toLowerCase() + '.';
  22. }
  23. config.hosts.muc = '{{ $XMPP_MUC_DOMAIN_PREFIX }}.'+subdomain+'{{ $XMPP_DOMAIN }}';
  24. {{ else -}}
  25. config.hosts.muc = '{{ $XMPP_MUC_DOMAIN }}';
  26. {{ end -}}
  27. {{ if $ENABLE_AUTH -}}
  28. {{ if $ENABLE_GUESTS -}}
  29. // When using authentication, domain for guest users.
  30. config.hosts.anonymousdomain = '{{ $XMPP_GUEST_DOMAIN }}';
  31. {{ end -}}
  32. // Domain for authenticated users. Defaults to <domain>.
  33. config.hosts.authdomain = '{{ $XMPP_DOMAIN }}';
  34. {{ end -}}
  35. config.bosh = '/http-bind';
  36. {{ if $ENABLE_XMPP_WEBSOCKET -}}
  37. config.websocket = 'wss://{{ $PUBLIC_URL_DOMAIN }}/xmpp-websocket';
  38. {{ end -}}
  39. {{ if $CONFIG_EXTERNAL_CONNECT -}}
  40. {{ if $ENABLE_SUBDOMAINS -}}
  41. config.externalConnectUrl = '/<!--# echo var="subdir" default="" -->http-pre-bind';
  42. {{ else -}}
  43. config.externalConnectUrl = '/http-pre-bind';
  44. {{ end -}}
  45. {{ end -}}