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