Skip to main content

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:

  1. Find the setting in config.json. In this case, ServiceSettings.SiteURL.
  2. Add MM_ to the beginning and convert all characters to uppercase and replace the . with _. For example, MM_SERVICESETTINGS_SITEURL.
  3. 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.

  1. Create a JSON file that contains the custom configuration defaults. For example, custom.json.
  2. When starting the server, point the custom defaults environment variable to the defaults file: MM_CUSTOM_DEFAULTS_PATH=custom.json.