mirror of
https://github.com/matrix-org/pantalaimon.git
synced 2025-01-06 13:18:07 -05:00
Add configuration option for client_max_size
This commit is contained in:
parent
b5a419e488
commit
196bd48726
@ -40,6 +40,7 @@ class PanConfigParser(configparser.ConfigParser):
|
||||
"HistoryFetchDelay": "3000",
|
||||
"DebugEncryption": "False",
|
||||
"DropOldKeys": "False",
|
||||
"ClientMaxSize": "104857600",
|
||||
},
|
||||
converters={
|
||||
"address": parse_address,
|
||||
@ -124,6 +125,7 @@ class ServerConfig:
|
||||
requests in seconds.
|
||||
drop_old_keys (bool): Should Pantalaimon only keep the most recent
|
||||
decryption key around.
|
||||
client_max_size (int): The maximum size of a request, in bytes.
|
||||
"""
|
||||
|
||||
name = attr.ib(type=str)
|
||||
@ -141,6 +143,7 @@ class ServerConfig:
|
||||
indexing_batch_size = attr.ib(type=int, default=100)
|
||||
history_fetch_delay = attr.ib(type=int, default=3)
|
||||
drop_old_keys = attr.ib(type=bool, default=False)
|
||||
client_max_size = attr.ib(type=int, default=1024**2 * 100)
|
||||
|
||||
|
||||
@attr.s
|
||||
@ -235,6 +238,13 @@ class PanConfig:
|
||||
listen_set.add(listen_tuple)
|
||||
drop_old_keys = section.getboolean("DropOldKeys")
|
||||
|
||||
client_max_size = section.getint("ClientMaxSize")
|
||||
|
||||
if not 0 < client_max_size:
|
||||
raise PanConfigError(
|
||||
"The client max size must be a positive integer"
|
||||
)
|
||||
|
||||
server_conf = ServerConfig(
|
||||
section_name,
|
||||
homeserver,
|
||||
@ -249,6 +259,7 @@ class PanConfig:
|
||||
indexing_batch_size,
|
||||
history_fetch_delay / 1000,
|
||||
drop_old_keys,
|
||||
client_max_size,
|
||||
)
|
||||
|
||||
self.servers[section_name] = server_conf
|
||||
|
@ -62,8 +62,7 @@ async def init(data_dir, server_conf, send_queue, recv_queue):
|
||||
client_store_class=store_class,
|
||||
)
|
||||
|
||||
# 100 MB max POST size
|
||||
app = web.Application(client_max_size=1024**2 * 100)
|
||||
app = web.Application(client_max_size=server_conf.client_max_size)
|
||||
|
||||
app.add_routes(
|
||||
[
|
||||
|
Loading…
Reference in New Issue
Block a user