diff options
-rw-r--r-- | synapse/config/_base.py | 2 | ||||
-rw-r--r-- | synapse/config/registration.py | 21 |
2 files changed, 20 insertions, 3 deletions
diff --git a/synapse/config/_base.py b/synapse/config/_base.py index 31f6530978..2aee6cfcbb 100644 --- a/synapse/config/_base.py +++ b/synapse/config/_base.py @@ -186,6 +186,7 @@ class Config(object): tls_certificate_path=None, tls_private_key_path=None, acme_domain=None, + account_threepid_delegates=None, ): """Build a default configuration file @@ -257,6 +258,7 @@ class Config(object): tls_certificate_path=tls_certificate_path, tls_private_key_path=tls_private_key_path, acme_domain=acme_domain, + account_threepid_delegates=account_threepid_delegates, ) ) diff --git a/synapse/config/registration.py b/synapse/config/registration.py index d4654e99b3..b5816d294e 100644 --- a/synapse/config/registration.py +++ b/synapse/config/registration.py @@ -15,8 +15,10 @@ import os from distutils.util import strtobool +from textwrap import indent import pkg_resources +import yaml from synapse.config._base import Config, ConfigError from synapse.types import RoomAlias @@ -124,7 +126,9 @@ class RegistrationConfig(Config): session_lifetime = self.parse_duration(session_lifetime) self.session_lifetime = session_lifetime - def generate_config_section(self, generate_secrets=False, **kwargs): + def generate_config_section( + self, generate_secrets=False, account_threepid_delegates=None, **kwargs + ): if generate_secrets: registration_shared_secret = 'registration_shared_secret: "%s"' % ( random_string_with_symbols(50), @@ -134,6 +138,18 @@ class RegistrationConfig(Config): "# registration_shared_secret: <PRIVATE STRING>" ) + if account_threepid_delegates: + account_threepid_delegates = indent( + yaml.dump(account_threepid_delegates), " " * 4 + ).lstrip() + + else: + account_threepid_delegates = indent( + "#email: https://example.com # Delegate email sending to example.org" + "\n#msisdn: http://localhost:8090 # Delegate SMS sending to this local process", + " " * 12, + ).lstrip() + return ( """\ ## Registration ## @@ -294,8 +310,7 @@ class RegistrationConfig(Config): # https://matrix.org/docs/spec/identity_service/latest # account_threepid_delegates: - #email: https://example.com # Delegate email sending to example.org - #msisdn: http://localhost:8090 # Delegate SMS sending to this local process + %(account_threepid_delegates)s # Users who register on this homeserver will automatically be joined # to these rooms |