mirror of
https://github.com/matrix-org/pantalaimon.git
synced 2025-01-22 21:31:04 -05:00
config: Handle some invalid configurations.
This commit is contained in:
parent
2987589854
commit
3d34a26dac
@ -124,6 +124,8 @@ class PanConfig:
|
||||
if self.log_level is None:
|
||||
self.log_level = config["Default"].getloglevel("LogLevel")
|
||||
|
||||
listen_set = set()
|
||||
|
||||
try:
|
||||
for section_name, section in config.items():
|
||||
|
||||
@ -131,11 +133,24 @@ class PanConfig:
|
||||
continue
|
||||
|
||||
homeserver = section.geturl("Homeserver")
|
||||
|
||||
if not homeserver:
|
||||
raise PanConfigError(f"Homserver is not set for "
|
||||
f"section {section_name}")
|
||||
|
||||
listen_address = section.getaddress("ListenAddress")
|
||||
listen_port = section.getint("ListenPort")
|
||||
ssl = section.getboolean("SSL")
|
||||
proxy = section.geturl("Proxy")
|
||||
|
||||
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(
|
||||
homeserver,
|
||||
listen_address,
|
||||
|
Loading…
Reference in New Issue
Block a user