2021-11-23 16:21:19 +01:00
|
|
|
import argparse
|
|
|
|
from typing import (
|
|
|
|
Any,
|
2022-05-11 15:43:22 +02:00
|
|
|
Collection,
|
2021-11-23 16:21:19 +01:00
|
|
|
Dict,
|
|
|
|
Iterable,
|
2022-05-11 15:43:22 +02:00
|
|
|
Iterator,
|
2021-11-23 16:21:19 +01:00
|
|
|
List,
|
2022-05-11 15:43:22 +02:00
|
|
|
Literal,
|
2021-11-23 16:21:19 +01:00
|
|
|
MutableMapping,
|
|
|
|
Optional,
|
|
|
|
Tuple,
|
|
|
|
Type,
|
|
|
|
TypeVar,
|
|
|
|
Union,
|
2022-05-11 15:43:22 +02:00
|
|
|
overload,
|
2021-11-23 16:21:19 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
import jinja2
|
2019-10-10 10:39:35 +02:00
|
|
|
|
2023-01-12 11:52:07 +01:00
|
|
|
from synapse.config import ( # noqa: F401
|
2021-04-19 20:16:34 +02:00
|
|
|
account_validity,
|
2019-10-10 10:39:35 +02:00
|
|
|
api,
|
|
|
|
appservice,
|
2020-12-18 13:33:57 +01:00
|
|
|
auth,
|
2022-03-11 19:46:45 +01:00
|
|
|
background_updates,
|
2021-07-05 17:32:12 +02:00
|
|
|
cache,
|
2019-10-10 10:39:35 +02:00
|
|
|
captcha,
|
|
|
|
cas,
|
2021-04-20 20:55:20 +02:00
|
|
|
consent,
|
2019-10-10 10:39:35 +02:00
|
|
|
database,
|
|
|
|
emailconfig,
|
2021-01-27 13:41:24 +01:00
|
|
|
experimental,
|
2021-06-21 15:38:59 +02:00
|
|
|
federation,
|
2021-04-20 20:55:20 +02:00
|
|
|
jwt,
|
2019-10-10 10:39:35 +02:00
|
|
|
key,
|
|
|
|
logger,
|
|
|
|
metrics,
|
2021-06-18 13:15:52 +02:00
|
|
|
modules,
|
2021-11-23 16:21:19 +01:00
|
|
|
oembed,
|
2021-04-20 20:55:20 +02:00
|
|
|
oidc,
|
2019-10-10 10:39:35 +02:00
|
|
|
password_auth_providers,
|
|
|
|
push,
|
|
|
|
ratelimiting,
|
2021-01-26 14:57:31 +01:00
|
|
|
redis,
|
2019-10-10 10:39:35 +02:00
|
|
|
registration,
|
|
|
|
repository,
|
2021-10-15 16:30:48 +02:00
|
|
|
retention,
|
2021-11-23 16:21:19 +01:00
|
|
|
room,
|
2019-10-10 10:39:35 +02:00
|
|
|
room_directory,
|
2021-04-20 20:55:20 +02:00
|
|
|
saml2,
|
2019-10-10 10:39:35 +02:00
|
|
|
server,
|
2021-04-20 20:55:20 +02:00
|
|
|
server_notices,
|
2019-10-10 10:39:35 +02:00
|
|
|
spam_checker,
|
2020-03-02 17:36:32 +01:00
|
|
|
sso,
|
2019-10-10 10:39:35 +02:00
|
|
|
stats,
|
|
|
|
third_party_event_rules,
|
|
|
|
tls,
|
|
|
|
tracer,
|
|
|
|
user_directory,
|
|
|
|
voip,
|
|
|
|
workers,
|
|
|
|
)
|
2023-05-18 12:11:30 +02:00
|
|
|
from synapse.types import StrSequence
|
2019-10-10 10:39:35 +02:00
|
|
|
|
2020-12-08 15:04:35 +01:00
|
|
|
class ConfigError(Exception):
|
2023-05-18 12:11:30 +02:00
|
|
|
def __init__(self, msg: str, path: Optional[StrSequence] = None):
|
2020-12-08 15:04:35 +01:00
|
|
|
self.msg = msg
|
|
|
|
self.path = path
|
2019-10-10 10:39:35 +02:00
|
|
|
|
2022-05-11 15:43:22 +02:00
|
|
|
def format_config_error(e: ConfigError) -> Iterator[str]: ...
|
|
|
|
|
2019-10-10 10:39:35 +02:00
|
|
|
MISSING_REPORT_STATS_CONFIG_INSTRUCTIONS: str
|
|
|
|
MISSING_REPORT_STATS_SPIEL: str
|
|
|
|
MISSING_SERVER_NAME: str
|
|
|
|
|
2021-11-23 16:21:19 +01:00
|
|
|
def path_exists(file_path: str) -> bool: ...
|
|
|
|
|
|
|
|
TRootConfig = TypeVar("TRootConfig", bound="RootConfig")
|
2019-10-10 10:39:35 +02:00
|
|
|
|
|
|
|
class RootConfig:
|
|
|
|
server: server.ServerConfig
|
2021-01-27 13:41:24 +01:00
|
|
|
experimental: experimental.ExperimentalConfig
|
2019-10-10 10:39:35 +02:00
|
|
|
tls: tls.TlsConfig
|
|
|
|
database: database.DatabaseConfig
|
|
|
|
logging: logger.LoggingConfig
|
2021-01-28 18:39:21 +01:00
|
|
|
ratelimiting: ratelimiting.RatelimitConfig
|
2019-10-10 10:39:35 +02:00
|
|
|
media: repository.ContentRepositoryConfig
|
2021-11-23 16:21:19 +01:00
|
|
|
oembed: oembed.OembedConfig
|
2019-10-10 10:39:35 +02:00
|
|
|
captcha: captcha.CaptchaConfig
|
|
|
|
voip: voip.VoipConfig
|
|
|
|
registration: registration.RegistrationConfig
|
2021-04-19 20:16:34 +02:00
|
|
|
account_validity: account_validity.AccountValidityConfig
|
2019-10-10 10:39:35 +02:00
|
|
|
metrics: metrics.MetricsConfig
|
|
|
|
api: api.ApiConfig
|
|
|
|
appservice: appservice.AppServiceConfig
|
|
|
|
key: key.KeyConfig
|
2021-04-20 20:55:20 +02:00
|
|
|
saml2: saml2.SAML2Config
|
2019-10-10 10:39:35 +02:00
|
|
|
cas: cas.CasConfig
|
2020-03-02 17:36:32 +01:00
|
|
|
sso: sso.SSOConfig
|
2021-04-20 20:55:20 +02:00
|
|
|
oidc: oidc.OIDCConfig
|
|
|
|
jwt: jwt.JWTConfig
|
2020-12-18 13:33:57 +01:00
|
|
|
auth: auth.AuthConfig
|
2019-10-10 10:39:35 +02:00
|
|
|
email: emailconfig.EmailConfig
|
|
|
|
worker: workers.WorkerConfig
|
|
|
|
authproviders: password_auth_providers.PasswordAuthProviderConfig
|
|
|
|
push: push.PushConfig
|
|
|
|
spamchecker: spam_checker.SpamCheckerConfig
|
2021-11-23 16:21:19 +01:00
|
|
|
room: room.RoomConfig
|
2019-10-10 10:39:35 +02:00
|
|
|
userdirectory: user_directory.UserDirectoryConfig
|
2021-04-20 20:55:20 +02:00
|
|
|
consent: consent.ConsentConfig
|
2019-10-10 10:39:35 +02:00
|
|
|
stats: stats.StatsConfig
|
2021-04-20 20:55:20 +02:00
|
|
|
servernotices: server_notices.ServerNoticesConfig
|
2019-10-10 10:39:35 +02:00
|
|
|
roomdirectory: room_directory.RoomDirectoryConfig
|
|
|
|
thirdpartyrules: third_party_event_rules.ThirdPartyRulesConfig
|
2021-11-23 16:21:19 +01:00
|
|
|
tracing: tracer.TracerConfig
|
2021-01-26 14:57:31 +01:00
|
|
|
redis: redis.RedisConfig
|
2021-06-18 13:15:52 +02:00
|
|
|
modules: modules.ModulesConfig
|
2021-07-05 17:32:12 +02:00
|
|
|
caches: cache.CacheConfig
|
2021-06-21 15:38:59 +02:00
|
|
|
federation: federation.FederationConfig
|
2021-10-15 16:30:48 +02:00
|
|
|
retention: retention.RetentionConfig
|
2022-03-11 19:46:45 +01:00
|
|
|
background_updates: background_updates.BackgroundUpdateConfig
|
2019-10-10 10:39:35 +02:00
|
|
|
|
2021-11-23 16:21:19 +01:00
|
|
|
config_classes: List[Type["Config"]] = ...
|
2022-05-11 15:43:22 +02:00
|
|
|
config_files: List[str]
|
|
|
|
def __init__(self, config_files: Collection[str] = ...) -> None: ...
|
2021-11-23 16:21:19 +01:00
|
|
|
def invoke_all(
|
|
|
|
self, func_name: str, *args: Any, **kwargs: Any
|
|
|
|
) -> MutableMapping[str, Any]: ...
|
2019-10-10 10:39:35 +02:00
|
|
|
@classmethod
|
|
|
|
def invoke_all_static(cls, func_name: str, *args: Any, **kwargs: Any) -> None: ...
|
|
|
|
def parse_config_dict(
|
2022-04-11 18:07:23 +02:00
|
|
|
self, config_dict: Dict[str, Any], config_dir_path: str, data_dir_path: str
|
2019-10-10 10:39:35 +02:00
|
|
|
) -> None: ...
|
|
|
|
def generate_config(
|
|
|
|
self,
|
|
|
|
config_dir_path: str,
|
|
|
|
data_dir_path: str,
|
|
|
|
server_name: str,
|
|
|
|
generate_secrets: bool = ...,
|
2021-11-23 16:21:19 +01:00
|
|
|
report_stats: Optional[bool] = ...,
|
2019-10-10 10:39:35 +02:00
|
|
|
open_private_ports: bool = ...,
|
|
|
|
listeners: Optional[Any] = ...,
|
|
|
|
tls_certificate_path: Optional[str] = ...,
|
|
|
|
tls_private_key_path: Optional[str] = ...,
|
2021-11-23 16:21:19 +01:00
|
|
|
) -> str: ...
|
2019-10-10 10:39:35 +02:00
|
|
|
@classmethod
|
2021-11-23 16:21:19 +01:00
|
|
|
def load_or_generate_config(
|
|
|
|
cls: Type[TRootConfig], description: str, argv: List[str]
|
|
|
|
) -> Optional[TRootConfig]: ...
|
2019-10-10 10:39:35 +02:00
|
|
|
@classmethod
|
2021-11-23 16:21:19 +01:00
|
|
|
def load_config(
|
|
|
|
cls: Type[TRootConfig], description: str, argv: List[str]
|
|
|
|
) -> TRootConfig: ...
|
2019-10-10 10:39:35 +02:00
|
|
|
@classmethod
|
2021-11-23 16:21:19 +01:00
|
|
|
def add_arguments_to_parser(
|
|
|
|
cls, config_parser: argparse.ArgumentParser
|
|
|
|
) -> None: ...
|
2019-10-10 10:39:35 +02:00
|
|
|
@classmethod
|
2021-11-23 16:21:19 +01:00
|
|
|
def load_config_with_parser(
|
|
|
|
cls: Type[TRootConfig], parser: argparse.ArgumentParser, argv: List[str]
|
|
|
|
) -> Tuple[TRootConfig, argparse.Namespace]: ...
|
2019-10-10 10:39:35 +02:00
|
|
|
def generate_missing_files(
|
|
|
|
self, config_dict: dict, config_dir_path: str
|
|
|
|
) -> None: ...
|
2022-05-11 15:43:22 +02:00
|
|
|
@overload
|
|
|
|
def reload_config_section(
|
|
|
|
self, section_name: Literal["caches"]
|
|
|
|
) -> cache.CacheConfig: ...
|
|
|
|
@overload
|
2023-01-12 11:52:07 +01:00
|
|
|
def reload_config_section(self, section_name: str) -> "Config": ...
|
2019-10-10 10:39:35 +02:00
|
|
|
|
|
|
|
class Config:
|
|
|
|
root: RootConfig
|
2021-11-23 16:21:19 +01:00
|
|
|
default_template_dir: str
|
2019-10-10 10:39:35 +02:00
|
|
|
def __init__(self, root_config: Optional[RootConfig] = ...) -> None: ...
|
|
|
|
@staticmethod
|
2021-11-23 16:21:19 +01:00
|
|
|
def parse_size(value: Union[str, int]) -> int: ...
|
2019-10-10 10:39:35 +02:00
|
|
|
@staticmethod
|
2021-11-23 16:21:19 +01:00
|
|
|
def parse_duration(value: Union[str, int]) -> int: ...
|
2019-10-10 10:39:35 +02:00
|
|
|
@staticmethod
|
2021-11-23 16:21:19 +01:00
|
|
|
def abspath(file_path: Optional[str]) -> str: ...
|
2019-10-10 10:39:35 +02:00
|
|
|
@classmethod
|
2021-11-23 16:21:19 +01:00
|
|
|
def path_exists(cls, file_path: str) -> bool: ...
|
2019-10-10 10:39:35 +02:00
|
|
|
@classmethod
|
2021-11-23 16:21:19 +01:00
|
|
|
def check_file(cls, file_path: str, config_name: str) -> str: ...
|
2019-10-10 10:39:35 +02:00
|
|
|
@classmethod
|
2021-11-23 16:21:19 +01:00
|
|
|
def ensure_directory(cls, dir_path: str) -> str: ...
|
2019-10-10 10:39:35 +02:00
|
|
|
@classmethod
|
2021-11-23 16:21:19 +01:00
|
|
|
def read_file(cls, file_path: str, config_name: str) -> str: ...
|
|
|
|
def read_template(self, filenames: str) -> jinja2.Template: ...
|
|
|
|
def read_templates(
|
|
|
|
self,
|
|
|
|
filenames: List[str],
|
|
|
|
custom_template_directories: Optional[Iterable[str]] = None,
|
|
|
|
) -> List[jinja2.Template]: ...
|
2019-10-10 10:39:35 +02:00
|
|
|
|
2021-11-23 16:21:19 +01:00
|
|
|
def read_config_files(config_files: Iterable[str]) -> Dict[str, Any]: ...
|
|
|
|
def find_config_files(search_paths: List[str]) -> List[str]: ...
|
2020-07-16 15:06:28 +02:00
|
|
|
|
|
|
|
class ShardedWorkerHandlingConfig:
|
|
|
|
instances: List[str]
|
|
|
|
def __init__(self, instances: List[str]) -> None: ...
|
2023-01-12 11:52:07 +01:00
|
|
|
def should_handle(self, instance_name: str, key: str) -> bool: ... # noqa: F811
|
2021-02-24 14:23:18 +01:00
|
|
|
|
|
|
|
class RoutableShardedWorkerHandlingConfig(ShardedWorkerHandlingConfig):
|
2023-01-12 11:52:07 +01:00
|
|
|
def get_instance(self, key: str) -> str: ... # noqa: F811
|
2021-03-09 16:03:37 +01:00
|
|
|
|
|
|
|
def read_file(file_path: Any, config_path: Iterable[str]) -> str: ...
|