diff --git a/synapse/rest/admin/__init__.py b/synapse/rest/admin/__init__.py
index b2514d9d0d..a03774c98a 100644
--- a/synapse/rest/admin/__init__.py
+++ b/synapse/rest/admin/__init__.py
@@ -247,7 +247,7 @@ def register_servlets(hs: "HomeServer", http_server: HttpServer) -> None:
RegistrationTokenRestServlet(hs).register(http_server)
# Some servlets only get registered for the main process.
- if hs.config.worker_app is None:
+ if hs.config.worker.worker_app is None:
SendServerNoticeServlet(hs).register(http_server)
diff --git a/synapse/rest/client/auth.py b/synapse/rest/client/auth.py
index df8cc4ac7a..7bb7801472 100644
--- a/synapse/rest/client/auth.py
+++ b/synapse/rest/client/auth.py
@@ -68,7 +68,10 @@ class AuthRestServlet(RestServlet):
html = self.terms_template.render(
session=session,
terms_url="%s_matrix/consent?v=%s"
- % (self.hs.config.public_baseurl, self.hs.config.user_consent_version),
+ % (
+ self.hs.config.server.public_baseurl,
+ self.hs.config.user_consent_version,
+ ),
myurl="%s/r0/auth/%s/fallback/web"
% (CLIENT_API_PREFIX, LoginType.TERMS),
)
@@ -135,7 +138,7 @@ class AuthRestServlet(RestServlet):
session=session,
terms_url="%s_matrix/consent?v=%s"
% (
- self.hs.config.public_baseurl,
+ self.hs.config.server.public_baseurl,
self.hs.config.user_consent_version,
),
myurl="%s/r0/auth/%s/fallback/web"
diff --git a/synapse/rest/client/login.py b/synapse/rest/client/login.py
index bcba106bdd..a6ede7e2f3 100644
--- a/synapse/rest/client/login.py
+++ b/synapse/rest/client/login.py
@@ -93,14 +93,14 @@ class LoginRestServlet(RestServlet):
self._address_ratelimiter = Ratelimiter(
store=hs.get_datastore(),
clock=hs.get_clock(),
- rate_hz=self.hs.config.rc_login_address.per_second,
- burst_count=self.hs.config.rc_login_address.burst_count,
+ rate_hz=self.hs.config.ratelimiting.rc_login_address.per_second,
+ burst_count=self.hs.config.ratelimiting.rc_login_address.burst_count,
)
self._account_ratelimiter = Ratelimiter(
store=hs.get_datastore(),
clock=hs.get_clock(),
- rate_hz=self.hs.config.rc_login_account.per_second,
- burst_count=self.hs.config.rc_login_account.burst_count,
+ rate_hz=self.hs.config.ratelimiting.rc_login_account.per_second,
+ burst_count=self.hs.config.ratelimiting.rc_login_account.burst_count,
)
# ensure the CAS/SAML/OIDC handlers are loaded on this worker instance.
@@ -486,7 +486,7 @@ class SsoRedirectServlet(RestServlet):
# register themselves with the main SSOHandler.
_load_sso_handlers(hs)
self._sso_handler = hs.get_sso_handler()
- self._public_baseurl = hs.config.public_baseurl
+ self._public_baseurl = hs.config.server.public_baseurl
async def on_GET(
self, request: SynapseRequest, idp_id: Optional[str] = None
diff --git a/synapse/rest/client/openid.py b/synapse/rest/client/openid.py
index 4dda6dce4b..add56d6998 100644
--- a/synapse/rest/client/openid.py
+++ b/synapse/rest/client/openid.py
@@ -69,7 +69,7 @@ class IdTokenServlet(RestServlet):
self.auth = hs.get_auth()
self.store = hs.get_datastore()
self.clock = hs.get_clock()
- self.server_name = hs.config.server_name
+ self.server_name = hs.config.server.server_name
async def on_POST(
self, request: SynapseRequest, user_id: str
diff --git a/synapse/rest/client/push_rule.py b/synapse/rest/client/push_rule.py
index fb3211bf3a..ecebc46e8d 100644
--- a/synapse/rest/client/push_rule.py
+++ b/synapse/rest/client/push_rule.py
@@ -59,7 +59,7 @@ class PushRuleRestServlet(RestServlet):
self.auth = hs.get_auth()
self.store = hs.get_datastore()
self.notifier = hs.get_notifier()
- self._is_worker = hs.config.worker_app is not None
+ self._is_worker = hs.config.worker.worker_app is not None
self._users_new_default_push_rules = hs.config.users_new_default_push_rules
diff --git a/synapse/rest/client/register.py b/synapse/rest/client/register.py
index 8f3dd2a101..abe4d7e205 100644
--- a/synapse/rest/client/register.py
+++ b/synapse/rest/client/register.py
@@ -330,11 +330,11 @@ class UsernameAvailabilityRestServlet(RestServlet):
# Artificially delay requests if rate > sleep_limit/window_size
sleep_limit=1,
# Amount of artificial delay to apply
- sleep_msec=1000,
+ sleep_delay=1000,
# Error with 429 if more than reject_limit requests are queued
reject_limit=1,
# Allow 1 request at a time
- concurrent_requests=1,
+ concurrent=1,
),
)
@@ -763,7 +763,10 @@ class RegisterRestServlet(RestServlet):
Returns:
dictionary for response from /register
"""
- result = {"user_id": user_id, "home_server": self.hs.hostname}
+ result: JsonDict = {
+ "user_id": user_id,
+ "home_server": self.hs.hostname,
+ }
if not params.get("inhibit_login", False):
device_id = params.get("device_id")
initial_display_name = params.get("initial_device_display_name")
@@ -814,7 +817,7 @@ class RegisterRestServlet(RestServlet):
user_id, device_id, initial_display_name, is_guest=True
)
- result = {
+ result: JsonDict = {
"user_id": user_id,
"device_id": device_id,
"access_token": access_token,
diff --git a/synapse/rest/client/room.py b/synapse/rest/client/room.py
index 9b0c546505..bf46dc60f2 100644
--- a/synapse/rest/client/room.py
+++ b/synapse/rest/client/room.py
@@ -388,7 +388,7 @@ class PublicRoomListRestServlet(TransactionRestServlet):
limit = None
handler = self.hs.get_room_list_handler()
- if server and server != self.hs.config.server_name:
+ if server and server != self.hs.config.server.server_name:
# Ensure the server is valid.
try:
parse_and_validate_server_name(server)
@@ -438,7 +438,7 @@ class PublicRoomListRestServlet(TransactionRestServlet):
limit = None
handler = self.hs.get_room_list_handler()
- if server and server != self.hs.config.server_name:
+ if server and server != self.hs.config.server.server_name:
# Ensure the server is valid.
try:
parse_and_validate_server_name(server)
diff --git a/synapse/rest/key/v2/local_key_resource.py b/synapse/rest/key/v2/local_key_resource.py
index a5fcd15e3a..25f6eb842f 100644
--- a/synapse/rest/key/v2/local_key_resource.py
+++ b/synapse/rest/key/v2/local_key_resource.py
@@ -86,12 +86,12 @@ class LocalKey(Resource):
json_object = {
"valid_until_ts": self.valid_until_ts,
- "server_name": self.config.server_name,
+ "server_name": self.config.server.server_name,
"verify_keys": verify_keys,
"old_verify_keys": old_verify_keys,
}
for key in self.config.signing_key:
- json_object = sign_json(json_object, self.config.server_name, key)
+ json_object = sign_json(json_object, self.config.server.server_name, key)
return json_object
def render_GET(self, request):
diff --git a/synapse/rest/key/v2/remote_key_resource.py b/synapse/rest/key/v2/remote_key_resource.py
index 63a40b1852..744360e5fd 100644
--- a/synapse/rest/key/v2/remote_key_resource.py
+++ b/synapse/rest/key/v2/remote_key_resource.py
@@ -224,7 +224,9 @@ class RemoteKey(DirectServeJsonResource):
for key_json in json_results:
key_json = json_decoder.decode(key_json.decode("utf-8"))
for signing_key in self.config.key_server_signing_keys:
- key_json = sign_json(key_json, self.config.server_name, signing_key)
+ key_json = sign_json(
+ key_json, self.config.server.server_name, signing_key
+ )
signed_keys.append(key_json)
diff --git a/synapse/rest/synapse/client/new_user_consent.py b/synapse/rest/synapse/client/new_user_consent.py
index 3869d18003..67c1ed1f5f 100644
--- a/synapse/rest/synapse/client/new_user_consent.py
+++ b/synapse/rest/synapse/client/new_user_consent.py
@@ -52,7 +52,7 @@ class NewUserConsentResource(DirectServeHtmlResource):
yield hs.config.sso.sso_template_dir
yield hs.config.sso.default_template_dir
- self._jinja_env = build_jinja_env(template_search_dirs(), hs.config)
+ self._jinja_env = build_jinja_env(list(template_search_dirs()), hs.config)
async def _async_render_GET(self, request: Request) -> None:
try:
diff --git a/synapse/rest/synapse/client/pick_username.py b/synapse/rest/synapse/client/pick_username.py
index c15b83c387..d30b478b98 100644
--- a/synapse/rest/synapse/client/pick_username.py
+++ b/synapse/rest/synapse/client/pick_username.py
@@ -80,7 +80,7 @@ class AccountDetailsResource(DirectServeHtmlResource):
yield hs.config.sso.sso_template_dir
yield hs.config.sso.default_template_dir
- self._jinja_env = build_jinja_env(template_search_dirs(), hs.config)
+ self._jinja_env = build_jinja_env(list(template_search_dirs()), hs.config)
async def _async_render_GET(self, request: Request) -> None:
try:
diff --git a/synapse/rest/well_known.py b/synapse/rest/well_known.py
index 19ac3af337..6a66a88c53 100644
--- a/synapse/rest/well_known.py
+++ b/synapse/rest/well_known.py
@@ -34,10 +34,10 @@ class WellKnownBuilder:
def get_well_known(self):
# if we don't have a public_baseurl, we can't help much here.
- if self._config.public_baseurl is None:
+ if self._config.server.public_baseurl is None:
return None
- result = {"m.homeserver": {"base_url": self._config.public_baseurl}}
+ result = {"m.homeserver": {"base_url": self._config.server.public_baseurl}}
if self._config.default_identity_server:
result["m.identity_server"] = {
|