mirror of
https://github.com/matrix-org/pantalaimon.git
synced 2025-01-23 05:41:13 -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:
|
if self.log_level is None:
|
||||||
self.log_level = config["Default"].getloglevel("LogLevel")
|
self.log_level = config["Default"].getloglevel("LogLevel")
|
||||||
|
|
||||||
|
listen_set = set()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for section_name, section in config.items():
|
for section_name, section in config.items():
|
||||||
|
|
||||||
@ -131,11 +133,24 @@ class PanConfig:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
homeserver = section.geturl("Homeserver")
|
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_address = section.getaddress("ListenAddress")
|
||||||
listen_port = section.getint("ListenPort")
|
listen_port = section.getint("ListenPort")
|
||||||
ssl = section.getboolean("SSL")
|
ssl = section.getboolean("SSL")
|
||||||
proxy = section.geturl("Proxy")
|
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(
|
server_conf = ServerConfig(
|
||||||
homeserver,
|
homeserver,
|
||||||
listen_address,
|
listen_address,
|
||||||
|
Loading…
Reference in New Issue
Block a user