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

Commit

Permalink
Update references to some server config 4.
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep committed Sep 24, 2021
1 parent 0064a34 commit 7747d6d
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion synapse/app/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def refresh_certificate(hs):
Refresh the TLS certificates that Synapse is using by re-reading them from
disk and updating the TLS context factories to use them.
"""
if not hs.config.has_tls_listener():
if not hs.config.server.has_tls_listener():
return

hs.config.read_certificate_from_disk()
Expand Down
8 changes: 4 additions & 4 deletions synapse/handlers/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def __init__(self, hs: "HomeServer"):
self.storage = hs.get_storage()
self.state_store = self.storage.state
self._event_serializer = hs.get_event_client_serializer()
self._ephemeral_events_enabled = hs.config.enable_ephemeral_messages
self._ephemeral_events_enabled = hs.config.server.enable_ephemeral_messages

# The scheduled call to self._expire_event. None if no call is currently
# scheduled.
Expand Down Expand Up @@ -461,11 +461,11 @@ def __init__(self, hs: "HomeServer"):
#
self._rooms_to_exclude_from_dummy_event_insertion: Dict[str, int] = {}
# The number of forward extremeities before a dummy event is sent.
self._dummy_events_threshold = hs.config.dummy_events_threshold
self._dummy_events_threshold = hs.config.server.dummy_events_threshold

if (
self.config.worker.run_background_tasks
and self.config.cleanup_extremities_with_dummy_events
and self.config.server.cleanup_extremities_with_dummy_events
):
self.clock.looping_call(
lambda: run_as_background_process(
Expand All @@ -477,7 +477,7 @@ def __init__(self, hs: "HomeServer"):

self._message_handler = hs.get_message_handler()

self._ephemeral_events_enabled = hs.config.enable_ephemeral_messages
self._ephemeral_events_enabled = hs.config.server.enable_ephemeral_messages

self._external_cache = hs.get_external_cache()

Expand Down
8 changes: 4 additions & 4 deletions synapse/handlers/room_member.py
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,7 @@ async def _is_remote_room_too_complex(
Returns: bool of whether the complexity is too great, or None
if unable to be fetched
"""
max_complexity = self.hs.config.limit_remote_rooms.complexity
max_complexity = self.hs.config.server.limit_remote_rooms.complexity
complexity = await self.federation_handler.get_room_complexity(
remote_room_hosts, room_id
)
Expand All @@ -1436,7 +1436,7 @@ async def _is_local_room_too_complex(self, room_id: str) -> bool:
Args:
room_id: The room ID to check for complexity.
"""
max_complexity = self.hs.config.limit_remote_rooms.complexity
max_complexity = self.hs.config.server.limit_remote_rooms.complexity
complexity = await self.store.get_room_complexity(room_id)

return complexity["v1"] > max_complexity
Expand Down Expand Up @@ -1472,7 +1472,7 @@ async def _remote_join(
if too_complex is True:
raise SynapseError(
code=400,
msg=self.hs.config.limit_remote_rooms.complexity_error,
msg=self.hs.config.server.limit_remote_rooms.complexity_error,
errcode=Codes.RESOURCE_LIMIT_EXCEEDED,
)

Expand Down Expand Up @@ -1507,7 +1507,7 @@ async def _remote_join(
)
raise SynapseError(
code=400,
msg=self.hs.config.limit_remote_rooms.complexity_error,
msg=self.hs.config.server.limit_remote_rooms.complexity_error,
errcode=Codes.RESOURCE_LIMIT_EXCEEDED,
)

Expand Down
10 changes: 5 additions & 5 deletions synapse/rest/client/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ async def on_POST(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
)

if existing_user_id is None:
if self.config.request_token_inhibit_3pid_errors:
if self.config.server.request_token_inhibit_3pid_errors:
# Make the client think the operation succeeded. See the rationale in the
# comments for request_token_inhibit_3pid_errors.
# Also wait for some random amount of time between 100ms and 1s to make it
Expand Down Expand Up @@ -403,7 +403,7 @@ async def on_POST(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
existing_user_id = await self.store.get_user_id_by_threepid("email", email)

if existing_user_id is not None:
if self.config.request_token_inhibit_3pid_errors:
if self.config.server.request_token_inhibit_3pid_errors:
# Make the client think the operation succeeded. See the rationale in the
# comments for request_token_inhibit_3pid_errors.
# Also wait for some random amount of time between 100ms and 1s to make it
Expand Down Expand Up @@ -486,7 +486,7 @@ async def on_POST(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
existing_user_id = await self.store.get_user_id_by_threepid("msisdn", msisdn)

if existing_user_id is not None:
if self.hs.config.request_token_inhibit_3pid_errors:
if self.hs.config.server.request_token_inhibit_3pid_errors:
# Make the client think the operation succeeded. See the rationale in the
# comments for request_token_inhibit_3pid_errors.
# Also wait for some random amount of time between 100ms and 1s to make it
Expand Down Expand Up @@ -857,8 +857,8 @@ def assert_valid_next_link(hs: "HomeServer", next_link: str) -> None:
# If the domain whitelist is set, the domain must be in it
if (
valid
and hs.config.next_link_domain_whitelist is not None
and next_link_parsed.hostname not in hs.config.next_link_domain_whitelist
and hs.config.server.next_link_domain_whitelist is not None
and next_link_parsed.hostname not in hs.config.server.next_link_domain_whitelist
):
valid = False

Expand Down
4 changes: 2 additions & 2 deletions synapse/rest/client/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ async def on_POST(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
)

if existing_user_id is not None:
if self.hs.config.request_token_inhibit_3pid_errors:
if self.hs.config.server.request_token_inhibit_3pid_errors:
# Make the client think the operation succeeded. See the rationale in the
# comments for request_token_inhibit_3pid_errors.
# Also wait for some random amount of time between 100ms and 1s to make it
Expand Down Expand Up @@ -209,7 +209,7 @@ async def on_POST(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
)

if existing_user_id is not None:
if self.hs.config.request_token_inhibit_3pid_errors:
if self.hs.config.server.request_token_inhibit_3pid_errors:
# Make the client think the operation succeeded. See the rationale in the
# comments for request_token_inhibit_3pid_errors.
# Also wait for some random amount of time between 100ms and 1s to make it
Expand Down
2 changes: 1 addition & 1 deletion synapse/storage/databases/main/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def __init__(
self._clock = hs.get_clock()
self._instance_name = hs.get_instance_name()

self._ephemeral_messages_enabled = hs.config.enable_ephemeral_messages
self._ephemeral_messages_enabled = hs.config.server.enable_ephemeral_messages
self.is_mine_id = hs.is_mine_id

# Ideally we'd move these ID gens here, unfortunately some other ID
Expand Down

0 comments on commit 7747d6d

Please sign in to comment.