35 lines
1.5 KiB
Text
35 lines
1.5 KiB
Text
<?php
|
|
|
|
/*
|
|
Mattermost integration.
|
|
-----------------------
|
|
|
|
0. Current implementation requires user credentials to be the same
|
|
as in the Kolab server. Thanks to this we can auto-login users.
|
|
1. It has to use the same domain, if it's using different we have to use a proxy:
|
|
Following Apache config worked for me with kolab_chat_url=https://kolab.example.com/mattermost
|
|
|
|
ProxyPreserveHost Off
|
|
RewriteEngine On
|
|
RewriteCond %{REQUEST_URI} /api/v[0-9]+/(users/)?websocket [NC,OR]
|
|
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC,OR]
|
|
RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
|
|
RewriteRule .* ws://mattermost.example.com:8065%{REQUEST_URI} [P,QSA,L]
|
|
ProxyPass /mattermost http://mattermost.example.com:8065
|
|
ProxyPass /static http://mattermost.example.com:8065/static
|
|
ProxyPass /help http://mattermost.example.com:8065/help
|
|
ProxyPass /api http://mattermost.example.com:8065/api
|
|
ProxyPass /api/v4/websocket ws://mattermost.example.com:8065/api/v4/websocket
|
|
ProxyPass /api/v4/users/websocket ws://mattermost.example.com:8065/api/v4/users/websocket
|
|
|
|
2. Enabling CORS connections in Mattermost config: AllowCorsFrom:"*"
|
|
*/
|
|
|
|
// Chat application name. For now only 'mattermost' is supported.
|
|
$config['kolab_chat_driver'] = 'mattermost';
|
|
|
|
// Chat application URL
|
|
$config['kolab_chat_url'] = 'https://mattermost.example.com';
|
|
|
|
// Enables opening chat in a new window (or tab)
|
|
$config['kolab_chat_extwin'] = false;
|