mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 00:54:47 -04:00
Create a ListenerConfig object (#7681)
This ended up being a bit more invasive than I'd hoped for (not helped by generic_worker duplicating some of the code from homeserver), but hopefully it's an improvement. The idea is that, rather than storing unstructured `dict`s in the config for the listener configurations, we instead parse it into a structured `ListenerConfig` object.
This commit is contained in:
parent
789606577a
commit
03619324fc
13 changed files with 248 additions and 167 deletions
|
@ -19,6 +19,7 @@ from typing import Optional
|
|||
from twisted.python.failure import Failure
|
||||
from twisted.web.server import Request, Site
|
||||
|
||||
from synapse.config.server import ListenerConfig
|
||||
from synapse.http import redact_uri
|
||||
from synapse.http.request_metrics import RequestMetrics, requests_counter
|
||||
from synapse.logging.context import LoggingContext, PreserveLoggingContext
|
||||
|
@ -350,7 +351,7 @@ class SynapseSite(Site):
|
|||
self,
|
||||
logger_name,
|
||||
site_tag,
|
||||
config,
|
||||
config: ListenerConfig,
|
||||
resource,
|
||||
server_version_string,
|
||||
*args,
|
||||
|
@ -360,7 +361,8 @@ class SynapseSite(Site):
|
|||
|
||||
self.site_tag = site_tag
|
||||
|
||||
proxied = config.get("x_forwarded", False)
|
||||
assert config.http_options is not None
|
||||
proxied = config.http_options.x_forwarded
|
||||
self.requestFactory = XForwardedForRequest if proxied else SynapseRequest
|
||||
self.access_logger = logging.getLogger(logger_name)
|
||||
self.server_version_string = server_version_string.encode("ascii")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue