当前位置: 首页>>代码示例>>Python>>正文


Python HomeServerConfig.parse_config_dict方法代码示例

本文整理汇总了Python中synapse.config.homeserver.HomeServerConfig.parse_config_dict方法的典型用法代码示例。如果您正苦于以下问题:Python HomeServerConfig.parse_config_dict方法的具体用法?Python HomeServerConfig.parse_config_dict怎么用?Python HomeServerConfig.parse_config_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在synapse.config.homeserver.HomeServerConfig的用法示例。


在下文中一共展示了HomeServerConfig.parse_config_dict方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setup_test_homeserver

# 需要导入模块: from synapse.config.homeserver import HomeServerConfig [as 别名]
# 或者: from synapse.config.homeserver.HomeServerConfig import parse_config_dict [as 别名]
    def setup_test_homeserver(self, *args, **kwargs):
        """
        Set up the test homeserver, meant to be called by the overridable
        make_homeserver. It automatically passes through the test class's
        clock & reactor.

        Args:
            See tests.utils.setup_test_homeserver.

        Returns:
            synapse.server.HomeServer
        """
        kwargs = dict(kwargs)
        kwargs.update(self._hs_args)
        if "config" not in kwargs:
            config = self.default_config()
        else:
            config = kwargs["config"]

        # Parse the config from a config dict into a HomeServerConfig
        config_obj = HomeServerConfig()
        config_obj.parse_config_dict(config)
        kwargs["config"] = config_obj

        hs = setup_test_homeserver(self.addCleanup, *args, **kwargs)
        stor = hs.get_datastore()

        # Run the database background updates.
        if hasattr(stor, "do_next_background_update"):
            while not self.get_success(stor.has_completed_background_updates()):
                self.get_success(stor.do_next_background_update(1))

        return hs
开发者ID:matrix-org,项目名称:synapse,代码行数:35,代码来源:unittest.py

示例2: default_config

# 需要导入模块: from synapse.config.homeserver import HomeServerConfig [as 别名]
# 或者: from synapse.config.homeserver.HomeServerConfig import parse_config_dict [as 别名]
def default_config(name, parse=False):
    """
    Create a reasonable test config.
    """
    config_dict = {
        "server_name": name,
        "media_store_path": "media",
        "uploads_path": "uploads",
        # the test signing key is just an arbitrary ed25519 key to keep the config
        # parser happy
        "signing_key": "ed25519 a_lPym qvioDNmfExFBRPgdTU+wtFYKq4JfwFRv7sYVgWvmgJg",
        "event_cache_size": 1,
        "enable_registration": True,
        "enable_registration_captcha": False,
        "macaroon_secret_key": "not even a little secret",
        "expire_access_token": False,
        "trusted_third_party_id_servers": [],
        "room_invite_state_types": [],
        "password_providers": [],
        "worker_replication_url": "",
        "worker_app": None,
        "email_enable_notifs": False,
        "block_non_admin_invites": False,
        "federation_domain_whitelist": None,
        "filter_timeline_limit": 5000,
        "user_directory_search_all_users": False,
        "user_consent_server_notice_content": None,
        "block_events_without_consent_error": None,
        "user_consent_at_registration": False,
        "user_consent_policy_name": "Privacy Policy",
        "media_storage_providers": [],
        "autocreate_auto_join_rooms": True,
        "auto_join_rooms": [],
        "limit_usage_by_mau": False,
        "hs_disabled": False,
        "hs_disabled_message": "",
        "hs_disabled_limit_type": "",
        "max_mau_value": 50,
        "mau_trial_days": 0,
        "mau_stats_only": False,
        "mau_limits_reserved_threepids": [],
        "admin_contact": None,
        "rc_federation": {
            "reject_limit": 10,
            "sleep_limit": 10,
            "sleep_delay": 10,
            "concurrent": 10,
        },
        "rc_message": {"per_second": 10000, "burst_count": 10000},
        "rc_registration": {"per_second": 10000, "burst_count": 10000},
        "rc_login": {
            "address": {"per_second": 10000, "burst_count": 10000},
            "account": {"per_second": 10000, "burst_count": 10000},
            "failed_attempts": {"per_second": 10000, "burst_count": 10000},
        },
        "saml2_enabled": False,
        "public_baseurl": None,
        "default_identity_server": None,
        "key_refresh_interval": 24 * 60 * 60 * 1000,
        "old_signing_keys": {},
        "tls_fingerprints": [],
        "use_frozen_dicts": False,
        # We need a sane default_room_version, otherwise attempts to create
        # rooms will fail.
        "default_room_version": "1",
        # disable user directory updates, because they get done in the
        # background, which upsets the test runner.
        "update_user_directory": False,
    }

    if parse:
        config = HomeServerConfig()
        config.parse_config_dict(config_dict)
        return config

    return config_dict
开发者ID:matrix-org,项目名称:synapse,代码行数:78,代码来源:utils.py


注:本文中的synapse.config.homeserver.HomeServerConfig.parse_config_dict方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。