mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Adding webserver mode to the system console. Automatic enabling of gzip on existing servers (#3458)
This commit is contained in:
committed by
Joram Wilander
parent
ce8cb14eb5
commit
da0747ac7a
@@ -23,7 +23,7 @@
|
||||
"SessionCacheInMinutes": 10,
|
||||
"WebsocketSecurePort": 443,
|
||||
"WebsocketPort": 80,
|
||||
"WebserverMode": "regular",
|
||||
"WebserverMode": "gzip",
|
||||
"EnableCustomEmoji": false,
|
||||
"RestrictCustomEmojiCreation": "all"
|
||||
},
|
||||
@@ -188,4 +188,4 @@
|
||||
"LocaleAttribute": "",
|
||||
"LoginButtonText": "With SAML"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -623,7 +623,9 @@ func (o *Config) SetDefaults() {
|
||||
|
||||
if o.ServiceSettings.WebserverMode == nil {
|
||||
o.ServiceSettings.WebserverMode = new(string)
|
||||
*o.ServiceSettings.WebserverMode = "regular"
|
||||
*o.ServiceSettings.WebserverMode = "gzip"
|
||||
} else if *o.ServiceSettings.WebserverMode == "regular" {
|
||||
*o.ServiceSettings.WebserverMode = "gzip"
|
||||
}
|
||||
|
||||
if o.ServiceSettings.EnableCustomEmoji == nil {
|
||||
|
||||
@@ -10,6 +10,7 @@ import {FormattedMessage} from 'react-intl';
|
||||
import SettingsGroup from './settings_group.jsx';
|
||||
import TextSetting from './text_setting.jsx';
|
||||
import ReloadConfigButton from './reload_config.jsx';
|
||||
import WebserverModeDropdownSetting from './webserver_mode_dropdown_setting.jsx';
|
||||
|
||||
export default class ConfigurationSettings extends AdminSettings {
|
||||
constructor(props) {
|
||||
@@ -20,7 +21,8 @@ export default class ConfigurationSettings extends AdminSettings {
|
||||
this.renderSettings = this.renderSettings.bind(this);
|
||||
|
||||
this.state = Object.assign(this.state, {
|
||||
listenAddress: props.config.ServiceSettings.ListenAddress
|
||||
listenAddress: props.config.ServiceSettings.ListenAddress,
|
||||
webserverMode: props.config.ServiceSettings.WebserverMode
|
||||
});
|
||||
}
|
||||
|
||||
@@ -32,6 +34,7 @@ export default class ConfigurationSettings extends AdminSettings {
|
||||
|
||||
getConfigFromState(config) {
|
||||
config.ServiceSettings.ListenAddress = this.state.listenAddress;
|
||||
config.ServiceSettings.WebserverMode = this.state.webserverMode;
|
||||
|
||||
return config;
|
||||
}
|
||||
@@ -68,8 +71,13 @@ export default class ConfigurationSettings extends AdminSettings {
|
||||
value={this.state.listenAddress}
|
||||
onChange={this.handleChange}
|
||||
/>
|
||||
<WebserverModeDropdownSetting
|
||||
value={this.state.webserverMode}
|
||||
onChange={this.handleChange}
|
||||
disabled={false}
|
||||
/>
|
||||
<ReloadConfigButton/>
|
||||
</SettingsGroup>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
import React from 'react';
|
||||
import * as Utils from 'utils/utils.jsx';
|
||||
|
||||
import DropdownSetting from './dropdown_setting.jsx';
|
||||
import {FormattedMessage} from 'react-intl';
|
||||
|
||||
const WEBSERVER_MODE_HELP_TEXT = (
|
||||
<div>
|
||||
<table
|
||||
className='table table-bordered table-margin--none'
|
||||
cellPadding='5'
|
||||
>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td className='help-text'>
|
||||
<FormattedMessage
|
||||
id='admin.webserverModeGzip'
|
||||
defaultMessage='gzip'
|
||||
/>
|
||||
</td>
|
||||
<td className='help-text'>
|
||||
<FormattedMessage
|
||||
id='admin.webserverModeGzipDescription'
|
||||
defaultMessage='The Mattermost server will serve static files compressed with gzip.'
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className='help-text'>
|
||||
<FormattedMessage
|
||||
id='admin.webserverModeUncompressed'
|
||||
defaultMessage='Uncompressed'
|
||||
/>
|
||||
</td>
|
||||
<td className='help-text'>
|
||||
<FormattedMessage
|
||||
id='admin.webserverModeUncompressedDescription'
|
||||
defaultMessage='The Mattermost server will serve static files uncompressed.'
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className='help-text'>
|
||||
<FormattedMessage
|
||||
id='admin.webserverModeDisabled'
|
||||
defaultMessage='Disabled'
|
||||
/>
|
||||
</td>
|
||||
<td className='help-text'>
|
||||
<FormattedMessage
|
||||
id='admin.webserverModeDisabledDescription'
|
||||
defaultMessage='The Mattermost server will not serve static files.'
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p className='help-text'>
|
||||
<FormattedMessage
|
||||
id='admin.webserverModeHelpText'
|
||||
defaultMessage='gzip compression applies to static content files. It is recommended to enable gzip to improve performance unless your environment has specific restrictions, such as a web proxy that distributes gzip files poorly. This setting requires a server restart to take effect.'
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
|
||||
export default class WebserverModeDropdownSetting extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<DropdownSetting
|
||||
id='webserverMode'
|
||||
values={[
|
||||
{value: 'gzip', text: Utils.localizeMessage('admin.webserverModeGzip', 'gzip')},
|
||||
{value: 'uncompressed', text: Utils.localizeMessage('admin.webserverModeUncompressed', 'Uncompressed')},
|
||||
{value: 'disabled', text: Utils.localizeMessage('admin.webserverModeDiabled', 'Disabled')}
|
||||
]}
|
||||
label={
|
||||
<FormattedMessage
|
||||
id='admin.webserverModeTitle'
|
||||
defaultMessage='Webserver Mode:'
|
||||
/>
|
||||
}
|
||||
value={this.props.value}
|
||||
onChange={this.props.onChange}
|
||||
disabled={this.props.disabled}
|
||||
helpText={WEBSERVER_MODE_HELP_TEXT}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
WebserverModeDropdownSetting.defaultProps = {
|
||||
};
|
||||
|
||||
WebserverModeDropdownSetting.propTypes = {
|
||||
value: React.PropTypes.string.isRequired,
|
||||
onChange: React.PropTypes.func.isRequired,
|
||||
disabled: React.PropTypes.bool.isRequired
|
||||
};
|
||||
@@ -691,6 +691,14 @@
|
||||
"admin.user_item.switchToEmail": "Switch to Email/Password",
|
||||
"admin.user_item.sysAdmin": "System Admin",
|
||||
"admin.user_item.teamAdmin": "Team Admin",
|
||||
"admin.webserverModeGzip": "gzip",
|
||||
"admin.webserverModeGzipDescription": "The Mattermost server will serve static files compressed with gzip.",
|
||||
"admin.webserverModeUncompressed": "Uncompressed",
|
||||
"admin.webserverModeUncompressedDescription": "The Mattermost server will serve static files uncompressed.",
|
||||
"admin.webserverModeDisabled": "Disabled",
|
||||
"admin.webserverModeDisabledDescription": "The Mattermost server will not serve static files.",
|
||||
"admin.webserverModeHelpText": "gzip compression applies to static content files. It is recommended to enable gzip to improve performance unless your environment has specific restrictions, such as a web proxy that distributes gzip files poorly. This setting requires a server restart to take effect.",
|
||||
"admin.webserverModeTitle": "Webserver Mode:",
|
||||
"analytics.chart.loading": "Loading...",
|
||||
"analytics.chart.meaningful": "Not enough data for a meaningful representation.",
|
||||
"analytics.system.activeUsers": "Active Users With Posts",
|
||||
|
||||
Reference in New Issue
Block a user