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

Throw if the appservice config list is the wrong type #15425

Merged
merged 5 commits into from
Apr 12, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move config check to read_config
  • Loading branch information
Half-Shot committed Apr 12, 2023
commit b5cfe5b64f1160bacb293c16f8667aa451603b5b
15 changes: 8 additions & 7 deletions synapse/config/appservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,21 @@ class AppServiceConfig(Config):

def read_config(self, config: JsonDict, **kwargs: Any) -> None:
self.app_service_config_files = config.get("app_service_config_files", [])
if not isinstance(self.app_service_config_files, list):
# type-ignore: this function gets arbitrary json value; we do use this path.
raise ConfigError(
"Expected '%s' to be a list of AS config files:"
% (self.app_service_config_files),
"app_service_config_files"
)

self.track_appservice_user_ips = config.get("track_appservice_user_ips", False)


def load_appservices(
hostname: str, config_files: List[str]
) -> List[ApplicationService]:
"""Returns a list of Application Services from the config files."""
if not isinstance(config_files, list):
# type-ignore: this function gets arbitrary json value; we do use this path.
raise ConfigError(
"Expected '%s' to be a list of AS config files:"
% (config_files)
"app_service_config_files"
)

# Dicts of value -> filename
seen_as_tokens: Dict[str, str] = {}
Expand Down