Skip to content
Snippets Groups Projects
config_documentation.md 117 KiB
Newer Older
  • Learn to ignore specific revisions
  • 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317
         * `messages_from_person`: Subject to use to notify about multiple messages from one or more users in
            a room which doesn't have a name. Defaults to "[%(app)s] You have messages on %(app)s from %(person)s..."
         * `messages_in_room`: Subject to use to notify about multiple messages in a room which has a
            name. Defaults to "[%(app)s] You have messages on %(app)s in the %(room)s room..."
         * `messages_in_room_and_others`: Subject to use to notify about multiple messages in multiple rooms. 
            Defaults to "[%(app)s] You have messages on %(app)s in the %(room)s room and others..."
         * `messages_from_person_and_others`: Subject to use to notify about multiple messages from multiple persons in
            multiple rooms. This is similar to the setting above except it's used when
            the room in which the notification was triggered has no name. Defaults to 
            "[%(app)s] You have messages on %(app)s from %(person)s and others..."
         * `invite_from_person_to_room`: Subject to use to notify about an invite to a room which has a name. 
            Defaults to  "[%(app)s] %(person)s has invited you to join the %(room)s room on %(app)s..."
         * `invite_from_person`: Subject to use to notify about an invite to a room which doesn't have a
            name. Defaults to "[%(app)s] %(person)s has invited you to chat on %(app)s..."
         * `password_reset`: Subject to use when sending a password reset email. Defaults to "[%(server_name)s] Password reset"
         * `email_validation`: Subject to use when sending a verification email to assert an address's
            ownership. Defaults to "[%(server_name)s] Validate your email"
    
    Example configuration:
    ```yaml
    email:
      smtp_host: mail.server
      smtp_port: 587
      smtp_user: "exampleusername"
      smtp_pass: "examplepassword"
      require_transport_security: true
      enable_tls: false
      notif_from: "Your Friendly %(app)s homeserver <noreply@example.com>"
      app_name: my_branded_matrix_server
      enable_notifs: true
      notif_for_new_users: false
      client_base_url: "http://localhost/riot"
      validation_token_lifetime: 15m
      invite_client_location: https://app.element.io
    
      subjects:
        message_from_person_in_room: "[%(app)s] You have a message on %(app)s from %(person)s in the %(room)s room..."
        message_from_person: "[%(app)s] You have a message on %(app)s from %(person)s..."
        messages_from_person: "[%(app)s] You have messages on %(app)s from %(person)s..."
        messages_in_room: "[%(app)s] You have messages on %(app)s in the %(room)s room..."
        messages_in_room_and_others: "[%(app)s] You have messages on %(app)s in the %(room)s room and others..."
        messages_from_person_and_others: "[%(app)s] You have messages on %(app)s from %(person)s and others..."
        invite_from_person_to_room: "[%(app)s] %(person)s has invited you to join the %(room)s room on %(app)s..."
        invite_from_person: "[%(app)s] %(person)s has invited you to chat on %(app)s..."
        password_reset: "[%(server_name)s] Password reset"
        email_validation: "[%(server_name)s] Validate your email"
    ```
    ---
    ## Push ##
    Configuration settings related to push notifications
    
    ---
    Config option: `push`
    
    This setting defines options for push notifications. 
    
    This option has a number of sub-options. They are as follows:
    * `include_content`: Clients requesting push notifications can either have the body of
       the message sent in the notification poke along with other details
       like the sender, or just the event ID and room ID (`event_id_only`).
       If clients choose the to have the body sent, this option controls whether the
       notification request includes the content of the event (other details
       like the sender are still included). If `event_id_only` is enabled, it
       has no effect.
       For modern android devices the notification content will still appear
       because it is loaded by the app. iPhone, however will send a
       notification saying only that a message arrived and who it came from.
       Defaults to true. Set to false to only include the event ID and room ID in push notification payloads.
    * `group_unread_count_by_room: false`: When a push notification is received, an unread count is also sent.
       This number can either be calculated as the number of unread messages  for the user, or the number of *rooms* the 
       user has unread messages in. Defaults to true, meaning push clients will see the number of
       rooms with unread messages in them. Set to false to instead send the number
       of unread messages.
    
    Example configuration:
    ```yaml
    push:
      include_content: false
      group_unread_count_by_room: false
    ```
    ---
    ## Rooms ##
    Config options relating to rooms.
    
    ---
    Config option: `encryption_enabled_by_default`
    
    Controls whether locally-created rooms should be end-to-end encrypted by
    default.
    
    Possible options are "all", "invite", and "off". They are defined as:
    
    * "all": any locally-created room
    * "invite": any room created with the `private_chat` or `trusted_private_chat`
       room creation presets
    * "off": this option will take no effect
    
    The default value is "off".
    
    Note that this option will only affect rooms created after it is set. It
    will also not affect rooms created by other servers.
    
    Example configuration:
    ```yaml
    encryption_enabled_by_default_for_room_type: invite
    ```
    ---
    Config option: `enable_group_creation`
    
    Set to true to allow non-server-admin users to create groups on this server
    
    Example configuration:
    ```yaml
    enable_group_creation: true
    ```
    ---
    Config option: `group_creation_prefix`
    
    If enabled/present, non-server admins can only create groups with local parts
    starting with this prefix.
    
    Example configuration:
    ```yaml
    group_creation_prefix: "unofficial_"
    ```
    ---
    Config option: `user_directory`
    
    This setting defines options related to the user directory. 
    
    This option has the following sub-options:
    * `enabled`:  Defines whether users can search the user directory. If false then
       empty responses are returned to all queries. Defaults to true.
    * `search_all_users`: Defines whether to search all users visible to your HS when searching
       the user directory. If false, search results will only contain users
        visible in public rooms and users sharing a room with the requester.
        Defaults to false.
        NB. If you set this to true, and the last time the user_directory search
        indexes were (re)built was before Synapse 1.44, you'll have to
        rebuild the indexes in order to search through all known users.
        These indexes are built the first time Synapse starts; admins can
        manually trigger a rebuild via API following the instructions at
             https://matrix-org.github.io/synapse/latest/usage/administration/admin_api/background_updates.html#run
        Set to true to return search results containing all known users, even if that
        user does not share a room with the requester.
    * `prefer_local_users`: Defines whether to prefer local users in search query results.
       If set to true, local users are more likely to appear above remote users when searching the 
       user directory. Defaults to false.
    
    Example configuration:
    ```yaml
    user_directory:
        enabled: false
        search_all_users: true
        prefer_local_users: true
    ```
    ---
    Config option: `user_consent`
    
    For detailed instructions on user consent configuration, see [here](../../consent_tracking.md).
    
    Parts of this section are required if enabling the `consent` resource under
    `listeners`, in particular `template_dir` and `version`. # TODO: link `listeners`
    
    * `template_dir`: gives the location of the templates for the HTML forms.
      This directory should contain one subdirectory per language (eg, `en`, `fr`),
      and each language directory should contain the policy document (named as
      <version>.html) and a success page (success.html).
    
    * `version`: specifies the 'current' version of the policy document. It defines
       the version to be served by the consent resource if there is no 'v'
       parameter.
    
    * `server_notice_content`: if enabled, will send a user a "Server Notice"
       asking them to consent to the privacy policy. The `server_notices` section ##TODO: link
       must also be configured for this to work. Notices will *not* be sent to
       guest users unless `send_server_notice_to_guests` is set to true.
    
    * `block_events_error`, if set, will block any attempts to send events
       until the user consents to the privacy policy. The value of the setting is
       used as the text of the error.
    
    * `require_at_registration`, if enabled, will add a step to the registration
       process, similar to how captcha works. Users will be required to accept the
       policy before their account is created.
    
    * `policy_name` is the display name of the policy users will see when registering
       for an account. Has no effect unless `require_at_registration` is enabled.
       Defaults to "Privacy Policy".
    
    Example configuration:
    ```yaml
    user_consent:
      template_dir: res/templates/privacy
      version: 1.0
      server_notice_content:
        msgtype: m.text
        body: >-
          To continue using this homeserver you must review and agree to the
          terms and conditions at %(consent_uri)s
      send_server_notice_to_guests: true
      block_events_error: >-
        To continue using this homeserver you must review and agree to the
        terms and conditions at %(consent_uri)s
      require_at_registration: false
      policy_name: Privacy Policy
    ```
    ---
    Config option: `stats`
    
    Settings for local room and user statistics collection. See [here](../../room_and_user_statistics.md)
    for more. 
    
    * `enabled`: Set to false to disable room and user statistics. Note that doing
       so may cause certain features (such as the room directory) not to work
       correctly. Defaults to true. 
    
    Example configuration:
    ```yaml
    stats:  
      enabled: false
    ```
    ---
    Config option: `server_notices`
    
    Use this setting to enable a room which can be used to send notices
    from the server to users. It is a special room which users cannot leave; notices
    in the room come from a special "notices" user id.
    
    If you use this setting, you *must* define the `system_mxid_localpart`
    sub-setting, which defines the id of the user which will be used to send the
    notices.
    
    Sub-options for this setting include:
    * `system_mxid_display_name`: set the display name of the "notices" user
    * `system_mxid_avatar_url`: set the avatar for the "notices" user
    * `room_name`: set the room name of the server notices room
    
    Example configuration:
    ```yaml
    server_notices:
      system_mxid_localpart: notices
      system_mxid_display_name: "Server Notices"
      system_mxid_avatar_url: "mxc://server.com/oumMVlgDnLYFaPVkExemNVVZ"
      room_name: "Server Notices"
    ```
    ---
    Config option: `enable_room_list_search`
    
    Set to false to disable searching the public room list. When disabled
    blocks searching local and remote room lists for local and remote
    users by always returning an empty list for all queries. Defaults to true. 
    
    Example configuration:
    ```yaml
    enable_room_list_search: false
    ```
    ---
    Config option: `alias_creation`
    
    The `alias_creation` option controls who is allowed to create aliases
    on this server.
    
    The format of this option is a list of rules that contain globs that
    match against user_id, room_id and the new alias (fully qualified with
    server name). The action in the first rule that matches is taken,
    which can currently either be "allow" or "deny".
    
    Missing user_id/room_id/alias fields default to "*".
    
    If no rules match the request is denied. An empty list means no one
    can create aliases.
    
    Options for the rules include:
    * `user_id`: Matches against the creator of the alias. Defaults to "*".
    * `alias`: Matches against the alias being created. Defaults to "*".
    * `room_id`: Matches against the room ID the alias is being pointed at. Defaults to "*"
    * `action`: Whether to "allow" or "deny" the request if the rule matches. Defaults to allow. 
    
    Example configuration:
    ```yaml
    alias_creation_rules:
      - user_id: "bad_user"
        alias: "spammy_alias"
        room_id: "*"
        action: deny
    ```
    ---
    Config options: `room_list_publication_rules`
    
    The `room_list_publication_rules` option controls who can publish and
    which rooms can be published in the public room list.
    
    The format of this option is the same as that for
    `alias_creation_rules`.
    
    If the room has one or more aliases associated with it, only one of
    the aliases needs to match the alias rule. If there are no aliases
    then only rules with `alias: *` match.
    
    If no rules match the request is denied. An empty list means no one
    can publish rooms.
    
    Options for the rules include:
    * `user_id`: Matches against the creator of the alias. Defaults to "*".
    * `alias`: Matches against any current local or canonical aliases associated with the room. Defaults to "*".
    * `room_id`: Matches against the room ID being published. Defaults to "*".
    * `action`: Whether to "allow" or "deny" the request if the rule matches. Defaults to allow. 
    
    Example configuration:
    ```yaml
    room_list_publication_rules:
      - user_id: "*"
        alias: "*"
        room_id: "*"
        action: allow
    ```
    
    
    ---
    Config option: `default_power_level_content_override`
    
    The `default_power_level_content_override` option controls the default power
    levels for rooms.
    
    Useful if you know that your users need special permissions in rooms
    that they create (e.g. to send particular types of state events without
    needing an elevated power level).  This takes the same shape as the
    `power_level_content_override` parameter in the /createRoom API, but
    is applied before that parameter.
    
    Note that each key provided inside a preset (for example `events` in the example
    below) will overwrite all existing defaults inside that key. So in the example
    below, newly-created private_chat rooms will have no rules for any event types
    except `com.example.foo`.
    
    Example configuration:
    ```yaml
    default_power_level_content_override:
       private_chat: { "events": { "com.example.foo" : 0 } }
       trusted_private_chat: null
       public_chat: null
    ```
    
    
    ---
    ## Opentracing ##
    Configuration options related to Opentracing support.
    
    ---
    Config option: `opentracing`
    
    These settings enable and configure opentracing, which implements distributed tracing.
    This allows you to observe the causal chains of events across servers
    including requests, key lookups etc., across any server running
    synapse or any other services which support opentracing
    (specifically those implemented with Jaeger).
    
    Sub-options include:
    * `enabled`: whether tracing is enabled. Set to true to enable. Disabled by default.
    * `homeserver_whitelist`: The list of homeservers we wish to send and receive span contexts and span baggage.
       See [here](../../opentracing.md) for more. 
       This is a list of regexes which are matched against the `server_name` of the homeserver.
       By default, it is empty, so no servers are matched.
    * `force_tracing_for_users`: # A list of the matrix IDs of users whose requests will always be traced,
       even if the tracing system would otherwise drop the traces due to probabilistic sampling.
        By default, the list is empty.
    * `jaeger_config`: Jaeger can be configured to sample traces at different rates.
       All configuration options provided by Jaeger can be set here. Jaeger's configuration is 
       mostly related to trace sampling which is documented [here](https://www.jaegertracing.io/docs/latest/sampling/).
    
    Example configuration:
    ```yaml
    opentracing:
        enabled: true
        homeserver_whitelist:
          - ".*"
        force_tracing_for_users:
          - "@user1:server_name"
          - "@user2:server_name"
    
        jaeger_config:
          sampler:
            type: const
            param: 1
          logging:
            false
    ```
    ---
    ## Workers ##
    Configuration options related to workers.
    
    ---
    Config option: `send_federation`
    
    Controls sending of outbound federation transactions on the main process.
    Set to false if using a federation sender worker. Defaults to true. 
    
    Example configuration:
    ```yaml
    send_federation: false
    ```
    ---
    Config option: `federation_sender_instances`
    
    It is possible to run multiple federation sender workers, in which case the
    work is balanced across them. Use this setting to list the senders. 
    
    This configuration setting must be shared between all federation sender workers, and if
    changed all federation sender workers must be stopped at the same time and then
    started, to ensure that all instances are running with the same config (otherwise
    events may be dropped). 
    
    Example configuration:
    ```yaml
    federation_sender_instances:
      - federation_sender1
    ```
    ---
    Config option: `instance_map`
    
    When using workers this should be a map from worker name to the
    HTTP replication listener of the worker, if configured. 
    
    Example configuration:
    ```yaml
    instance_map:
      worker1:
        host: localhost
        port: 8034
    ```
    ---
    Config option: `stream_writers`
    
    Experimental: When using workers you can define which workers should
    handle event persistence and typing notifications. Any worker
    specified here must also be in the `instance_map`.
    
    Example configuration:
    ```yaml
    stream_writers:
      events: worker1
      typing: worker1
    ```
    ---
    Config option: `run_background_task_on`
    
    The worker that is used to run background tasks (e.g. cleaning up expired
    data). If not provided this defaults to the main process.
    
    Example configuration:
    ```yaml
    run_background_tasks_on: worker1
    ```
    ---
    Config option: `worker_replication_secret`
    
    A shared secret used by the replication APIs to authenticate HTTP requests
    from workers.
    
    By default this is unused and traffic is not authenticated.
    
    Example configuration:
    ```yaml
    worker_replication_secret: "secret_secret"
    ```
    Config option: `redis`
    
    Configuration for Redis when using workers. This *must* be enabled when
    using workers (unless using old style direct TCP configuration).
    This setting has the following sub-options:
    * `enabled`: whether to use Redis support. Defaults to false. 
    * `host` and `port`: Optional host and port to use to connect to redis. Defaults to
       localhost and 6379
    * `password`: Optional password if configured on the Redis instance.
    
    Example configuration:
    ```yaml
    redis:
      enabled: true
      host: localhost
      port: 6379
      password: <secret_password>
    ```
    ## Background Updates ##
    Configuration settings related to background updates. 
    
    ---
    Config option: `background_updates`
    
    Background updates are database updates that are run in the background in batches.
    The duration, minimum batch size, default batch size, whether to sleep between batches and if so, how long to
    sleep can all be configured. This is helpful to speed up or slow down the updates.
    This setting has the following sub-options:
    * `background_update_duration_ms`: How long in milliseconds to run a batch of background updates for. Defaults to 100. 
       Set a different time to change the default.
    * `sleep_enabled`: Whether to sleep between updates. Defaults to true. Set to false to change the default.
    * `sleep_duration_ms`: If sleeping between updates, how long in milliseconds to sleep for. Defaults to 1000.
       Set a duration to change the default.
    * `min_batch_size`: Minimum size a batch of background updates can be. Must be greater than 0. Defaults to 1.
       Set a size to change the default.
    * `default_batch_size`: The batch size to use for the first iteration of a new background update. The default is 100.
       Set a size to change the default.
    
    Example configuration: 
    ```yaml
    background_updates:
        background_update_duration_ms: 500
        sleep_enabled: false
        sleep_duration_ms: 300
        min_batch_size: 10
        default_batch_size: 50