How to use the pantalaimon.config.PanConfigError function in pantalaimon

To help you get started, we’ve selected a few pantalaimon examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github matrix-org / pantalaimon / pantalaimon / config.py View on Github external
search_requests = section.getboolean("SearchRequests")
                index_encrypted_only = section.getboolean("IndexEncryptedOnly")

                indexing_batch_size = section.getint("IndexingBatchSize")

                if not 1 < indexing_batch_size <= 1000:
                    raise PanConfigError(
                        "The indexing batch size needs to be "
                        "a positive integer between 1 and "
                        "1000"
                    )

                history_fetch_delay = section.getint("HistoryFetchDelay")

                if not 100 < history_fetch_delay <= 10000:
                    raise PanConfigError(
                        "The history fetch delay needs to be "
                        "a positive integer between 100 and "
                        "10000"
                    )

                listen_tuple = (listen_address, listen_port)

                if listen_tuple in listen_set:
                    raise PanConfigError(
                        f"The listen address/port combination"
                        f" for section {section_name} was "
                        f"already defined before."
                    )
                listen_set.add(listen_tuple)

                server_conf = ServerConfig(
github matrix-org / pantalaimon / pantalaimon / config.py View on Github external
f"Homserver is not set for " f"section {section_name}"
                    )

                listen_address = section.getaddress("ListenAddress")
                listen_port = section.getint("ListenPort")
                ssl = section.getboolean("SSL")
                ignore_verification = section.getboolean("IgnoreVerification")
                keyring = section.getboolean("UseKeyring")
                proxy = section.geturl("Proxy")
                search_requests = section.getboolean("SearchRequests")
                index_encrypted_only = section.getboolean("IndexEncryptedOnly")

                indexing_batch_size = section.getint("IndexingBatchSize")

                if not 1 < indexing_batch_size <= 1000:
                    raise PanConfigError(
                        "The indexing batch size needs to be "
                        "a positive integer between 1 and "
                        "1000"
                    )

                history_fetch_delay = section.getint("HistoryFetchDelay")

                if not 100 < history_fetch_delay <= 10000:
                    raise PanConfigError(
                        "The history fetch delay needs to be "
                        "a positive integer between 100 and "
                        "10000"
                    )

                listen_tuple = (listen_address, listen_port)
github matrix-org / pantalaimon / pantalaimon / config.py View on Github external
listen_address,
                    listen_port,
                    proxy,
                    ssl,
                    ignore_verification,
                    keyring,
                    search_requests,
                    index_encrypted_only,
                    indexing_batch_size,
                    history_fetch_delay / 1000,
                )

                self.servers[section_name] = server_conf

        except ValueError as e:
            raise PanConfigError(e)
github matrix-org / pantalaimon / pantalaimon / config.py View on Github external
"1000"
                    )

                history_fetch_delay = section.getint("HistoryFetchDelay")

                if not 100 < history_fetch_delay <= 10000:
                    raise PanConfigError(
                        "The history fetch delay needs to be "
                        "a positive integer between 100 and "
                        "10000"
                    )

                listen_tuple = (listen_address, listen_port)

                if listen_tuple in listen_set:
                    raise PanConfigError(
                        f"The listen address/port combination"
                        f" for section {section_name} was "
                        f"already defined before."
                    )
                listen_set.add(listen_tuple)

                server_conf = ServerConfig(
                    section_name,
                    homeserver,
                    listen_address,
                    listen_port,
                    proxy,
                    ssl,
                    ignore_verification,
                    keyring,
                    search_requests,
github matrix-org / pantalaimon / pantalaimon / main.py View on Github external
conf_dir = user_config_dir("pantalaimon", "")
    data_dir = user_data_dir("pantalaimon", "")
    create_dirs(data_dir, conf_dir)

    config = config or os.path.join(conf_dir, "pantalaimon.conf")
    data_dir = data_path or data_dir

    if log_level:
        log_level = parse_log_level(log_level)

    pan_conf = PanConfig(config, log_level)

    try:
        pan_conf.read()
    except (OSError, PanConfigError) as e:
        context.fail(e)

    if not pan_conf.servers:
        context.fail("Homeserver is not configured.")

    logger.level = pan_conf.log_level

    if pan_conf.debug_encryption or debug_encryption:
        nio.crypto.logger.level = logbook.DEBUG

    StderrHandler().push_application()

    servers = []
    proxies = []

    if UI_ENABLED: