mirror of
https://github.com/matrix-org/pantalaimon.git
synced 2025-01-09 14:39:34 -05:00
config: Add a DebugEncryption setting to enable the nio crytpo logs.
This commit is contained in:
parent
b5ca82976c
commit
a51e93a868
@ -2,6 +2,7 @@
|
|||||||
LogLevel = Debug
|
LogLevel = Debug
|
||||||
SSL = True
|
SSL = True
|
||||||
Notifications = On
|
Notifications = On
|
||||||
|
DebugEncryption = True
|
||||||
|
|
||||||
[local-matrix]
|
[local-matrix]
|
||||||
Homeserver = https://localhost:8448
|
Homeserver = https://localhost:8448
|
||||||
|
@ -38,6 +38,7 @@ class PanConfigParser(configparser.ConfigParser):
|
|||||||
"IndexEncryptedOnly": "True",
|
"IndexEncryptedOnly": "True",
|
||||||
"IndexingBatchSize": "100",
|
"IndexingBatchSize": "100",
|
||||||
"HistoryFetchDelay": "3000",
|
"HistoryFetchDelay": "3000",
|
||||||
|
"DebugEncryption": "False",
|
||||||
},
|
},
|
||||||
converters={
|
converters={
|
||||||
"address": parse_address,
|
"address": parse_address,
|
||||||
@ -146,11 +147,14 @@ class PanConfig:
|
|||||||
config_path (str): The path where we should search for a configuration
|
config_path (str): The path where we should search for a configuration
|
||||||
file.
|
file.
|
||||||
filename (str): The name of the file that we should read.
|
filename (str): The name of the file that we should read.
|
||||||
|
debug_encryption (bool): Should debug logs be enabled for the Matrix
|
||||||
|
encryption support.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
config_file = attr.ib()
|
config_file = attr.ib()
|
||||||
|
|
||||||
log_level = attr.ib(default=None)
|
log_level = attr.ib(default=None)
|
||||||
|
debug_encryption = attr.ib(type=bool, default=None)
|
||||||
notifications = attr.ib(default=None)
|
notifications = attr.ib(default=None)
|
||||||
servers = attr.ib(init=False, default=attr.Factory(dict))
|
servers = attr.ib(init=False, default=attr.Factory(dict))
|
||||||
|
|
||||||
@ -172,6 +176,8 @@ class PanConfig:
|
|||||||
if self.notifications is None:
|
if self.notifications is None:
|
||||||
self.notifications = config["Default"].getboolean("Notifications")
|
self.notifications = config["Default"].getboolean("Notifications")
|
||||||
|
|
||||||
|
self.debug_encryption = config["Default"].getboolean("DebugEncryption")
|
||||||
|
|
||||||
listen_set = set()
|
listen_set = set()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -20,6 +20,8 @@ from typing import Optional
|
|||||||
import click
|
import click
|
||||||
import janus
|
import janus
|
||||||
import keyring
|
import keyring
|
||||||
|
import logbook
|
||||||
|
import nio
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
from appdirs import user_config_dir, user_data_dir
|
from appdirs import user_config_dir, user_data_dir
|
||||||
from logbook import StderrHandler
|
from logbook import StderrHandler
|
||||||
@ -127,10 +129,11 @@ async def message_router(receive_queue, send_queue, proxies):
|
|||||||
type=click.Choice(["error", "warning", "info", "debug"]),
|
type=click.Choice(["error", "warning", "info", "debug"]),
|
||||||
default=None,
|
default=None,
|
||||||
)
|
)
|
||||||
|
@click.option("--debug-encryption", is_flag=True)
|
||||||
@click.option("-c", "--config", type=click.Path(exists=True))
|
@click.option("-c", "--config", type=click.Path(exists=True))
|
||||||
@click.option("--data-path", type=click.Path(exists=True))
|
@click.option("--data-path", type=click.Path(exists=True))
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def main(context, log_level, config, data_path):
|
def main(context, log_level, debug_encryption, config, data_path):
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
|
|
||||||
conf_dir = user_config_dir("pantalaimon", "")
|
conf_dir = user_config_dir("pantalaimon", "")
|
||||||
@ -154,6 +157,10 @@ def main(context, log_level, config, data_path):
|
|||||||
context.fail("Homeserver is not configured.")
|
context.fail("Homeserver is not configured.")
|
||||||
|
|
||||||
logger.level = pan_conf.log_level
|
logger.level = pan_conf.log_level
|
||||||
|
|
||||||
|
if pan_conf.debug_encryption or debug_encryption:
|
||||||
|
nio.crypto.logger.level = logbook.DEBUG
|
||||||
|
|
||||||
StderrHandler().push_application()
|
StderrHandler().push_application()
|
||||||
|
|
||||||
servers = []
|
servers = []
|
||||||
|
Loading…
Reference in New Issue
Block a user