diff options
author | Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> | 2019-11-26 18:42:27 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-26 18:42:27 +0000 |
commit | ce578031f4d0fe6f1eb26de4cb3d30a4175468db (patch) | |
tree | f4bb43d389e0fefbbfdc03e173cc2c0eb11d0c4e | |
parent | Merge pull request #6343 from matrix-org/rav/event_auth/4 (diff) | |
download | synapse-ce578031f4d0fe6f1eb26de4cb3d30a4175468db.tar.xz |
Remove assertion and provide a clear warning on startup for missing public_baseurl (#6379)
-rw-r--r-- | changelog.d/6379.misc | 1 | ||||
-rw-r--r-- | synapse/config/emailconfig.py | 2 | ||||
-rw-r--r-- | synapse/config/registration.py | 7 | ||||
-rw-r--r-- | tests/rest/client/v2_alpha/test_register.py | 1 |
4 files changed, 11 insertions, 0 deletions
diff --git a/changelog.d/6379.misc b/changelog.d/6379.misc new file mode 100644 index 0000000000..725c2e7d87 --- /dev/null +++ b/changelog.d/6379.misc @@ -0,0 +1 @@ +Complain on startup instead of 500'ing during runtime when `public_baseurl` isn't set when necessary. \ No newline at end of file diff --git a/synapse/config/emailconfig.py b/synapse/config/emailconfig.py index 43fad0bf8b..ac1724045f 100644 --- a/synapse/config/emailconfig.py +++ b/synapse/config/emailconfig.py @@ -146,6 +146,8 @@ class EmailConfig(Config): if k not in email_config: missing.append("email." + k) + # public_baseurl is required to build password reset and validation links that + # will be emailed to users if config.get("public_baseurl") is None: missing.append("public_baseurl") diff --git a/synapse/config/registration.py b/synapse/config/registration.py index 1f6dac69da..ee9614c5f7 100644 --- a/synapse/config/registration.py +++ b/synapse/config/registration.py @@ -106,6 +106,13 @@ class RegistrationConfig(Config): account_threepid_delegates = config.get("account_threepid_delegates") or {} self.account_threepid_delegate_email = account_threepid_delegates.get("email") self.account_threepid_delegate_msisdn = account_threepid_delegates.get("msisdn") + if self.account_threepid_delegate_msisdn and not self.public_baseurl: + raise ConfigError( + "The configuration option `public_baseurl` is required if " + "`account_threepid_delegate.msisdn` is set, such that " + "clients know where to submit validation tokens to. Please " + "configure `public_baseurl`." + ) self.default_identity_server = config.get("default_identity_server") self.allow_guest_access = config.get("allow_guest_access", False) diff --git a/tests/rest/client/v2_alpha/test_register.py b/tests/rest/client/v2_alpha/test_register.py index dab87e5edf..c0d0d2b44e 100644 --- a/tests/rest/client/v2_alpha/test_register.py +++ b/tests/rest/client/v2_alpha/test_register.py @@ -203,6 +203,7 @@ class RegisterRestServletTestCase(unittest.HomeserverTestCase): @unittest.override_config( { + "public_baseurl": "https://test_server", "enable_registration_captcha": True, "user_consent": { "version": "1", |