mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-06-04 18:18:48 -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
|
@ -30,6 +30,16 @@ class FrontendProxyTests(HomeserverTestCase):
|
|||
def default_config(self):
|
||||
c = super().default_config()
|
||||
c["worker_app"] = "synapse.app.frontend_proxy"
|
||||
|
||||
c["worker_listeners"] = [
|
||||
{
|
||||
"type": "http",
|
||||
"port": 8080,
|
||||
"bind_addresses": ["0.0.0.0"],
|
||||
"resources": [{"names": ["client"]}],
|
||||
}
|
||||
]
|
||||
|
||||
return c
|
||||
|
||||
def test_listen_http_with_presence_enabled(self):
|
||||
|
@ -39,14 +49,8 @@ class FrontendProxyTests(HomeserverTestCase):
|
|||
# Presence is on
|
||||
self.hs.config.use_presence = True
|
||||
|
||||
config = {
|
||||
"port": 8080,
|
||||
"bind_addresses": ["0.0.0.0"],
|
||||
"resources": [{"names": ["client"]}],
|
||||
}
|
||||
|
||||
# Listen with the config
|
||||
self.hs._listen_http(config)
|
||||
self.hs._listen_http(self.hs.config.worker.worker_listeners[0])
|
||||
|
||||
# Grab the resource from the site that was told to listen
|
||||
self.assertEqual(len(self.reactor.tcpServers), 1)
|
||||
|
@ -67,14 +71,8 @@ class FrontendProxyTests(HomeserverTestCase):
|
|||
# Presence is off
|
||||
self.hs.config.use_presence = False
|
||||
|
||||
config = {
|
||||
"port": 8080,
|
||||
"bind_addresses": ["0.0.0.0"],
|
||||
"resources": [{"names": ["client"]}],
|
||||
}
|
||||
|
||||
# Listen with the config
|
||||
self.hs._listen_http(config)
|
||||
self.hs._listen_http(self.hs.config.worker.worker_listeners[0])
|
||||
|
||||
# Grab the resource from the site that was told to listen
|
||||
self.assertEqual(len(self.reactor.tcpServers), 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue