Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Comment out most options in the generated config. (#4863)
Browse files Browse the repository at this point in the history
Make it so that most options in the config are optional, and commented out in
the generated config.

The reasons this is a good thing are as follows:

* If we decide that we should change the default for an option, we can do so,
  and only those admins that have deliberately chosen to override that option
  will be stuck on the old setting.

* It moves us towards a point where we can get rid of the super-surprising
  feature of synapse where the default settings for the config come from the
  generated yaml.

* It makes setting up a test config for unit testing an order of magnitude
  easier (see forthcoming PR).

* It makes the generated config more consistent, and hopefully easier for users
  to understand.
  • Loading branch information
richvdh authored Mar 19, 2019
1 parent 282c973 commit fd463b4
Show file tree
Hide file tree
Showing 16 changed files with 230 additions and 171 deletions.
1 change: 1 addition & 0 deletions changelog.d/4863.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Comment out most options in the generated config.
153 changes: 80 additions & 73 deletions docs/sample_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ pid_file: DATADIR/homeserver.pid
# Zero is used to indicate synapse should set the soft limit to the
# hard limit.
#
soft_file_limit: 0
#soft_file_limit: 0

# Set to false to disable presence tracking on this homeserver.
#
use_presence: true
#use_presence: false

# The GC threshold parameters to pass to `gc.set_threshold`, if defined
#
Expand Down Expand Up @@ -359,7 +359,8 @@ database:
database: "DATADIR/homeserver.db"

# Number of events to cache in memory.
event_cache_size: "10K"
#
#event_cache_size: 10K


## Logging ##
Expand All @@ -373,11 +374,11 @@ log_config: "CONFDIR/SERVERNAME.log.config"

# Number of messages a client can send per second
#
rc_messages_per_second: 0.2
#rc_messages_per_second: 0.2

# Number of message a client can send before being throttled
#
rc_message_burst_count: 10.0
#rc_message_burst_count: 10.0

# Ratelimiting settings for registration and login.
#
Expand Down Expand Up @@ -415,27 +416,27 @@ rc_message_burst_count: 10.0

# The federation window size in milliseconds
#
federation_rc_window_size: 1000
#federation_rc_window_size: 1000

# The number of federation requests from a single server in a window
# before the server will delay processing the request.
#
federation_rc_sleep_limit: 10
#federation_rc_sleep_limit: 10

# The duration in milliseconds to delay processing events from
# remote servers by if they go over the sleep limit.
#
federation_rc_sleep_delay: 500
#federation_rc_sleep_delay: 500

# The maximum number of concurrent federation requests allowed
# from a single server
#
federation_rc_reject_limit: 50
#federation_rc_reject_limit: 50

# The number of federation requests to concurrently process from a
# single server
#
federation_rc_concurrent: 3
#federation_rc_concurrent: 3



Expand Down Expand Up @@ -464,44 +465,44 @@ uploads_path: "DATADIR/uploads"

# The largest allowed upload size in bytes
#
max_upload_size: "10M"
#max_upload_size: 10M

# Maximum number of pixels that will be thumbnailed
#
max_image_pixels: "32M"
#max_image_pixels: 32M

# Whether to generate new thumbnails on the fly to precisely match
# the resolution requested by the client. If true then whenever
# a new resolution is requested by the client the server will
# generate a new thumbnail. If false the server will pick a thumbnail
# from a precalculated list.
#
dynamic_thumbnails: false
#dynamic_thumbnails: false

# List of thumbnails to precalculate when an image is uploaded.
#
thumbnail_sizes:
- width: 32
height: 32
method: crop
- width: 96
height: 96
method: crop
- width: 320
height: 240
method: scale
- width: 640
height: 480
method: scale
- width: 800
height: 600
method: scale
#thumbnail_sizes:
# - width: 32
# height: 32
# method: crop
# - width: 96
# height: 96
# method: crop
# - width: 320
# height: 240
# method: scale
# - width: 640
# height: 480
# method: scale
# - width: 800
# height: 600
# method: scale

# Is the preview URL API enabled? If enabled, you *must* specify
# an explicit url_preview_ip_range_blacklist of IPs that the spider is
# denied from accessing.
#
url_preview_enabled: False
#url_preview_enabled: false

# List of IP address CIDR ranges that the URL preview spider is denied
# from accessing. There are no defaults: you must explicitly
Expand Down Expand Up @@ -566,32 +567,34 @@ url_preview_enabled: False
# - netloc: '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$'

# The largest allowed URL preview spidering size in bytes
max_spider_size: "10M"

#
#max_spider_size: 10M


## Captcha ##
# See docs/CAPTCHA_SETUP for full details of configuring this.

# This Home Server's ReCAPTCHA public key.
#
recaptcha_public_key: "YOUR_PUBLIC_KEY"
#recaptcha_public_key: "YOUR_PUBLIC_KEY"

# This Home Server's ReCAPTCHA private key.
#
recaptcha_private_key: "YOUR_PRIVATE_KEY"
#recaptcha_private_key: "YOUR_PRIVATE_KEY"

# Enables ReCaptcha checks when registering, preventing signup
# unless a captcha is answered. Requires a valid ReCaptcha
# public/private key.
#
enable_registration_captcha: False
#enable_registration_captcha: false

# A secret key used to bypass the captcha test entirely.
#
#captcha_bypass_secret: "YOUR_SECRET_HERE"

# The API endpoint to use for verifying m.login.recaptcha responses.
recaptcha_siteverify_api: "https://www.recaptcha.net/recaptcha/api/siteverify"
#
#recaptcha_siteverify_api: "https://www.recaptcha.net/recaptcha/api/siteverify"


## TURN ##
Expand All @@ -612,23 +615,25 @@ recaptcha_siteverify_api: "https://www.recaptcha.net/recaptcha/api/siteverify"

# How long generated TURN credentials last
#
turn_user_lifetime: "1h"
#turn_user_lifetime: 1h

# Whether guests should be allowed to use the TURN server.
# This defaults to True, otherwise VoIP will be unreliable for guests.
# However, it does introduce a slight security risk as it allows users to
# connect to arbitrary endpoints without having first signed up for a
# valid account (e.g. by passing a CAPTCHA).
#
turn_allow_guests: True
#turn_allow_guests: True


## Registration ##
#
# Registration can be rate-limited using the parameters in the "Ratelimiting"
# section of this file.

# Enable registration for new users.
enable_registration: False
#
#enable_registration: false

# The user must provide all of the below types of 3PID when registering.
#
Expand All @@ -639,7 +644,7 @@ enable_registration: False
# Explicitly disable asking for MSISDNs from the registration
# flow (overrides registrations_require_3pid if MSISDNs are set as required)
#
#disable_msisdn_registration: True
#disable_msisdn_registration: true

# Mandate that users are only allowed to associate certain formats of
# 3PIDs with accounts on this server.
Expand All @@ -663,13 +668,13 @@ enable_registration: False
# N.B. that increasing this will exponentially increase the time required
# to register or login - e.g. 24 => 2^24 rounds which will take >20 mins.
#
bcrypt_rounds: 12
#bcrypt_rounds: 12

# Allows users to register as guests without a password/email/etc, and
# participate in rooms hosted on this server which have been made
# accessible to anonymous users.
#
allow_guest_access: False
#allow_guest_access: false

# The identity server which we suggest that clients should use when users log
# in on this server.
Expand All @@ -685,9 +690,9 @@ allow_guest_access: False
# Also defines the ID server which will be called when an account is
# deactivated (one will be picked arbitrarily).
#
trusted_third_party_id_servers:
- matrix.org
- vector.im
#trusted_third_party_id_servers:
# - matrix.org
# - vector.im

# Users who register on this homeserver will automatically be joined
# to these rooms
Expand All @@ -701,14 +706,14 @@ trusted_third_party_id_servers:
# Setting to false means that if the rooms are not manually created,
# users cannot be auto-joined since they do not exist.
#
autocreate_auto_join_rooms: true
#autocreate_auto_join_rooms: true


## Metrics ###

# Enable collection and rendering of performance metrics
#
enable_metrics: False
#enable_metrics: False

# Enable sentry integration
# NOTE: While attempts are made to ensure that the logs don't contain
Expand All @@ -728,22 +733,24 @@ enable_metrics: False

# A list of event types that will be included in the room_invite_state
#
room_invite_state_types:
- "m.room.join_rules"
- "m.room.canonical_alias"
- "m.room.avatar"
- "m.room.encryption"
- "m.room.name"
#room_invite_state_types:
# - "m.room.join_rules"
# - "m.room.canonical_alias"
# - "m.room.avatar"
# - "m.room.encryption"
# - "m.room.name"


# A list of application service config file to use
# A list of application service config files to use
#
app_service_config_files: []
#app_service_config_files:
# - app_service_1.yaml
# - app_service_2.yaml

# Whether or not to track application service IP addresses. Implicitly
# Uncomment to enable tracking of application service IP addresses. Implicitly
# enables MAU tracking for application service users.
#
track_appservice_user_ips: False
#track_appservice_user_ips: True


# a secret which is used to sign access tokens. If none is specified,
Expand All @@ -754,7 +761,7 @@ track_appservice_user_ips: False

# Used to enable access token expiration.
#
expire_access_token: False
#expire_access_token: False

# a secret which is used to calculate HMACs for form values, to stop
# falsification of values. Must be specified for the User Consent
Expand Down Expand Up @@ -783,17 +790,16 @@ signing_key_path: "CONFDIR/SERVERNAME.signing.key"
# Determines how quickly servers will query to check which keys
# are still valid.
#
key_refresh_interval: "1d" # 1 Day.
#key_refresh_interval: 1d

# The trusted servers to download signing keys from.
#
perspectives:
servers:
"matrix.org":
verify_keys:
"ed25519:auto":
key: "Noi6WqcDj0QmPxCNQqgezwTlBKrfqehY1u2FyWP9uYw"

#perspectives:
# servers:
# "matrix.org":
# verify_keys:
# "ed25519:auto":
# key: "Noi6WqcDj0QmPxCNQqgezwTlBKrfqehY1u2FyWP9uYw"


# Enable SAML2 for registration and login. Uses pysaml2.
Expand Down Expand Up @@ -858,14 +864,15 @@ perspectives:
# algorithm: "HS256"



# Enable password for login.
#
password_config:
enabled: true
# Uncomment to disable password login
#
#enabled: false

# Uncomment and change to a secret random string for extra security.
# DO NOT CHANGE THIS AFTER INITIAL SETUP!
#pepper: ""
#
#pepper: "EVEN_MORE_SECRET"



Expand Down Expand Up @@ -934,9 +941,9 @@ password_config:
# example_option: 'things'


# Whether to allow non server admins to create groups on this server
# Uncomment to allow non-server-admin users to create groups on this server
#
enable_group_creation: false
#enable_group_creation: true

# If enabled, non server admins can only create groups with local parts
# starting with this prefix
Expand Down
12 changes: 6 additions & 6 deletions synapse/config/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ def default_config(cls, **kwargs):
# A list of event types that will be included in the room_invite_state
#
room_invite_state_types:
- "{JoinRules}"
- "{CanonicalAlias}"
- "{RoomAvatar}"
- "{RoomEncryption}"
- "{Name}"
#room_invite_state_types:
# - "{JoinRules}"
# - "{CanonicalAlias}"
# - "{RoomAvatar}"
# - "{RoomEncryption}"
# - "{Name}"
""".format(**vars(EventTypes))
Loading

0 comments on commit fd463b4

Please sign in to comment.