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