Environment variables
You can use environment variables to manage the configuration. Environment variables override settings in config.json. If a change to a setting in config.json requires a restart for it to take effect, then changes to the corresponding environment variable also require a server restart.
The name of the environment variable for any setting can be derived from the name of that setting in config.json. For example, to derive the name of the Site URL setting:
- Find the setting in
config.json. In this case, ServiceSettings.SiteURL. - Add
MM_to the beginning and convert all characters to uppercase and replace the.with_. For example, MM_SERVICESETTINGS_SITEURL. - The setting becomes
export MM_SERVICESETTINGS_SITEURL="http://example.com".
Override Mattermost license file
You can use an environment variable to override any license in the database or file configuration without replacing those licenses. When starting the server, specify the license key as MM_LICENSE with the contents of a license file.
Load custom configuration defaults
This custom configuration applies only if the values are not already present in the current server configuration.
- Create a JSON file that contains the custom configuration defaults. For example,
custom.json. - When starting the server, point the custom defaults environment variable to the defaults file:
MM_CUSTOM_DEFAULTS_PATH=custom.json.