mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
Merge pull request #1795 from matrix-org/erikj/port_defaults
Restore default bind address
This commit is contained in:
commit
641ccdbb14
@ -76,8 +76,7 @@ class AppserviceServer(HomeServer):
|
|||||||
|
|
||||||
def _listen_http(self, listener_config):
|
def _listen_http(self, listener_config):
|
||||||
port = listener_config["port"]
|
port = listener_config["port"]
|
||||||
bind_address = listener_config.get("bind_address", None)
|
bind_addresses = listener_config["bind_addresses"]
|
||||||
bind_addresses = listener_config.get("bind_addresses", [])
|
|
||||||
site_tag = listener_config.get("tag", port)
|
site_tag = listener_config.get("tag", port)
|
||||||
resources = {}
|
resources = {}
|
||||||
for res in listener_config["resources"]:
|
for res in listener_config["resources"]:
|
||||||
@ -87,9 +86,6 @@ class AppserviceServer(HomeServer):
|
|||||||
|
|
||||||
root_resource = create_resource_tree(resources, Resource())
|
root_resource = create_resource_tree(resources, Resource())
|
||||||
|
|
||||||
if bind_address is not None:
|
|
||||||
bind_addresses.append(bind_address)
|
|
||||||
|
|
||||||
for address in bind_addresses:
|
for address in bind_addresses:
|
||||||
reactor.listenTCP(
|
reactor.listenTCP(
|
||||||
port,
|
port,
|
||||||
@ -109,11 +105,7 @@ class AppserviceServer(HomeServer):
|
|||||||
if listener["type"] == "http":
|
if listener["type"] == "http":
|
||||||
self._listen_http(listener)
|
self._listen_http(listener)
|
||||||
elif listener["type"] == "manhole":
|
elif listener["type"] == "manhole":
|
||||||
bind_address = listener.get("bind_address", None)
|
bind_addresses = listener["bind_addresses"]
|
||||||
bind_addresses = listener.get("bind_addresses", [])
|
|
||||||
|
|
||||||
if bind_address is not None:
|
|
||||||
bind_addresses.append(bind_address)
|
|
||||||
|
|
||||||
for address in bind_addresses:
|
for address in bind_addresses:
|
||||||
reactor.listenTCP(
|
reactor.listenTCP(
|
||||||
|
@ -90,8 +90,7 @@ class ClientReaderServer(HomeServer):
|
|||||||
|
|
||||||
def _listen_http(self, listener_config):
|
def _listen_http(self, listener_config):
|
||||||
port = listener_config["port"]
|
port = listener_config["port"]
|
||||||
bind_address = listener_config.get("bind_address", None)
|
bind_addresses = listener_config["bind_addresses"]
|
||||||
bind_addresses = listener_config.get("bind_addresses", [])
|
|
||||||
site_tag = listener_config.get("tag", port)
|
site_tag = listener_config.get("tag", port)
|
||||||
resources = {}
|
resources = {}
|
||||||
for res in listener_config["resources"]:
|
for res in listener_config["resources"]:
|
||||||
@ -110,9 +109,6 @@ class ClientReaderServer(HomeServer):
|
|||||||
|
|
||||||
root_resource = create_resource_tree(resources, Resource())
|
root_resource = create_resource_tree(resources, Resource())
|
||||||
|
|
||||||
if bind_address is not None:
|
|
||||||
bind_addresses.append(bind_address)
|
|
||||||
|
|
||||||
for address in bind_addresses:
|
for address in bind_addresses:
|
||||||
reactor.listenTCP(
|
reactor.listenTCP(
|
||||||
port,
|
port,
|
||||||
@ -132,11 +128,7 @@ class ClientReaderServer(HomeServer):
|
|||||||
if listener["type"] == "http":
|
if listener["type"] == "http":
|
||||||
self._listen_http(listener)
|
self._listen_http(listener)
|
||||||
elif listener["type"] == "manhole":
|
elif listener["type"] == "manhole":
|
||||||
bind_address = listener.get("bind_address", None)
|
bind_addresses = listener["bind_addresses"]
|
||||||
bind_addresses = listener.get("bind_addresses", [])
|
|
||||||
|
|
||||||
if bind_address is not None:
|
|
||||||
bind_addresses.append(bind_address)
|
|
||||||
|
|
||||||
for address in bind_addresses:
|
for address in bind_addresses:
|
||||||
reactor.listenTCP(
|
reactor.listenTCP(
|
||||||
|
@ -86,8 +86,7 @@ class FederationReaderServer(HomeServer):
|
|||||||
|
|
||||||
def _listen_http(self, listener_config):
|
def _listen_http(self, listener_config):
|
||||||
port = listener_config["port"]
|
port = listener_config["port"]
|
||||||
bind_address = listener_config.get("bind_address", None)
|
bind_addresses = listener_config["bind_addresses"]
|
||||||
bind_addresses = listener_config.get("bind_addresses", [])
|
|
||||||
site_tag = listener_config.get("tag", port)
|
site_tag = listener_config.get("tag", port)
|
||||||
resources = {}
|
resources = {}
|
||||||
for res in listener_config["resources"]:
|
for res in listener_config["resources"]:
|
||||||
@ -101,9 +100,6 @@ class FederationReaderServer(HomeServer):
|
|||||||
|
|
||||||
root_resource = create_resource_tree(resources, Resource())
|
root_resource = create_resource_tree(resources, Resource())
|
||||||
|
|
||||||
if bind_address is not None:
|
|
||||||
bind_addresses.append(bind_address)
|
|
||||||
|
|
||||||
for address in bind_addresses:
|
for address in bind_addresses:
|
||||||
reactor.listenTCP(
|
reactor.listenTCP(
|
||||||
port,
|
port,
|
||||||
@ -123,11 +119,7 @@ class FederationReaderServer(HomeServer):
|
|||||||
if listener["type"] == "http":
|
if listener["type"] == "http":
|
||||||
self._listen_http(listener)
|
self._listen_http(listener)
|
||||||
elif listener["type"] == "manhole":
|
elif listener["type"] == "manhole":
|
||||||
bind_address = listener.get("bind_address", None)
|
bind_addresses = listener["bind_addresses"]
|
||||||
bind_addresses = listener.get("bind_addresses", [])
|
|
||||||
|
|
||||||
if bind_address is not None:
|
|
||||||
bind_addresses.append(bind_address)
|
|
||||||
|
|
||||||
for address in bind_addresses:
|
for address in bind_addresses:
|
||||||
reactor.listenTCP(
|
reactor.listenTCP(
|
||||||
|
@ -82,8 +82,7 @@ class FederationSenderServer(HomeServer):
|
|||||||
|
|
||||||
def _listen_http(self, listener_config):
|
def _listen_http(self, listener_config):
|
||||||
port = listener_config["port"]
|
port = listener_config["port"]
|
||||||
bind_address = listener_config.get("bind_address", None)
|
bind_addresses = listener_config["bind_addresses"]
|
||||||
bind_addresses = listener_config.get("bind_addresses", [])
|
|
||||||
site_tag = listener_config.get("tag", port)
|
site_tag = listener_config.get("tag", port)
|
||||||
resources = {}
|
resources = {}
|
||||||
for res in listener_config["resources"]:
|
for res in listener_config["resources"]:
|
||||||
@ -93,9 +92,6 @@ class FederationSenderServer(HomeServer):
|
|||||||
|
|
||||||
root_resource = create_resource_tree(resources, Resource())
|
root_resource = create_resource_tree(resources, Resource())
|
||||||
|
|
||||||
if bind_address is not None:
|
|
||||||
bind_addresses.append(bind_address)
|
|
||||||
|
|
||||||
for address in bind_addresses:
|
for address in bind_addresses:
|
||||||
reactor.listenTCP(
|
reactor.listenTCP(
|
||||||
port,
|
port,
|
||||||
@ -115,11 +111,7 @@ class FederationSenderServer(HomeServer):
|
|||||||
if listener["type"] == "http":
|
if listener["type"] == "http":
|
||||||
self._listen_http(listener)
|
self._listen_http(listener)
|
||||||
elif listener["type"] == "manhole":
|
elif listener["type"] == "manhole":
|
||||||
bind_address = listener.get("bind_address", None)
|
bind_addresses = listener["bind_addresses"]
|
||||||
bind_addresses = listener.get("bind_addresses", [])
|
|
||||||
|
|
||||||
if bind_address is not None:
|
|
||||||
bind_addresses.append(bind_address)
|
|
||||||
|
|
||||||
for address in bind_addresses:
|
for address in bind_addresses:
|
||||||
reactor.listenTCP(
|
reactor.listenTCP(
|
||||||
|
@ -107,8 +107,7 @@ def build_resource_for_web_client(hs):
|
|||||||
class SynapseHomeServer(HomeServer):
|
class SynapseHomeServer(HomeServer):
|
||||||
def _listener_http(self, config, listener_config):
|
def _listener_http(self, config, listener_config):
|
||||||
port = listener_config["port"]
|
port = listener_config["port"]
|
||||||
bind_address = listener_config.get("bind_address", None)
|
bind_addresses = listener_config["bind_addresses"]
|
||||||
bind_addresses = listener_config.get("bind_addresses", [])
|
|
||||||
tls = listener_config.get("tls", False)
|
tls = listener_config.get("tls", False)
|
||||||
site_tag = listener_config.get("tag", port)
|
site_tag = listener_config.get("tag", port)
|
||||||
|
|
||||||
@ -175,9 +174,6 @@ class SynapseHomeServer(HomeServer):
|
|||||||
|
|
||||||
root_resource = create_resource_tree(resources, root_resource)
|
root_resource = create_resource_tree(resources, root_resource)
|
||||||
|
|
||||||
if bind_address is not None:
|
|
||||||
bind_addresses.append(bind_address)
|
|
||||||
|
|
||||||
if tls:
|
if tls:
|
||||||
for address in bind_addresses:
|
for address in bind_addresses:
|
||||||
reactor.listenSSL(
|
reactor.listenSSL(
|
||||||
@ -212,11 +208,7 @@ class SynapseHomeServer(HomeServer):
|
|||||||
if listener["type"] == "http":
|
if listener["type"] == "http":
|
||||||
self._listener_http(config, listener)
|
self._listener_http(config, listener)
|
||||||
elif listener["type"] == "manhole":
|
elif listener["type"] == "manhole":
|
||||||
bind_address = listener.get("bind_address", None)
|
bind_addresses = listener["bind_addresses"]
|
||||||
bind_addresses = listener.get("bind_addresses", [])
|
|
||||||
|
|
||||||
if bind_address is not None:
|
|
||||||
bind_addresses.append(bind_address)
|
|
||||||
|
|
||||||
for address in bind_addresses:
|
for address in bind_addresses:
|
||||||
reactor.listenTCP(
|
reactor.listenTCP(
|
||||||
|
@ -87,8 +87,7 @@ class MediaRepositoryServer(HomeServer):
|
|||||||
|
|
||||||
def _listen_http(self, listener_config):
|
def _listen_http(self, listener_config):
|
||||||
port = listener_config["port"]
|
port = listener_config["port"]
|
||||||
bind_address = listener_config.get("bind_address", None)
|
bind_addresses = listener_config["bind_addresses"]
|
||||||
bind_addresses = listener_config.get("bind_addresses", [])
|
|
||||||
site_tag = listener_config.get("tag", port)
|
site_tag = listener_config.get("tag", port)
|
||||||
resources = {}
|
resources = {}
|
||||||
for res in listener_config["resources"]:
|
for res in listener_config["resources"]:
|
||||||
@ -107,9 +106,6 @@ class MediaRepositoryServer(HomeServer):
|
|||||||
|
|
||||||
root_resource = create_resource_tree(resources, Resource())
|
root_resource = create_resource_tree(resources, Resource())
|
||||||
|
|
||||||
if bind_address is not None:
|
|
||||||
bind_addresses.append(bind_address)
|
|
||||||
|
|
||||||
for address in bind_addresses:
|
for address in bind_addresses:
|
||||||
reactor.listenTCP(
|
reactor.listenTCP(
|
||||||
port,
|
port,
|
||||||
@ -129,11 +125,7 @@ class MediaRepositoryServer(HomeServer):
|
|||||||
if listener["type"] == "http":
|
if listener["type"] == "http":
|
||||||
self._listen_http(listener)
|
self._listen_http(listener)
|
||||||
elif listener["type"] == "manhole":
|
elif listener["type"] == "manhole":
|
||||||
bind_address = listener.get("bind_address", None)
|
bind_addresses = listener["bind_addresses"]
|
||||||
bind_addresses = listener.get("bind_addresses", [])
|
|
||||||
|
|
||||||
if bind_address is not None:
|
|
||||||
bind_addresses.append(bind_address)
|
|
||||||
|
|
||||||
for address in bind_addresses:
|
for address in bind_addresses:
|
||||||
reactor.listenTCP(
|
reactor.listenTCP(
|
||||||
|
@ -121,8 +121,7 @@ class PusherServer(HomeServer):
|
|||||||
|
|
||||||
def _listen_http(self, listener_config):
|
def _listen_http(self, listener_config):
|
||||||
port = listener_config["port"]
|
port = listener_config["port"]
|
||||||
bind_address = listener_config.get("bind_address", None)
|
bind_addresses = listener_config["bind_addresses"]
|
||||||
bind_addresses = listener_config.get("bind_addresses", [])
|
|
||||||
site_tag = listener_config.get("tag", port)
|
site_tag = listener_config.get("tag", port)
|
||||||
resources = {}
|
resources = {}
|
||||||
for res in listener_config["resources"]:
|
for res in listener_config["resources"]:
|
||||||
@ -132,9 +131,6 @@ class PusherServer(HomeServer):
|
|||||||
|
|
||||||
root_resource = create_resource_tree(resources, Resource())
|
root_resource = create_resource_tree(resources, Resource())
|
||||||
|
|
||||||
if bind_address is not None:
|
|
||||||
bind_addresses.append(bind_address)
|
|
||||||
|
|
||||||
for address in bind_addresses:
|
for address in bind_addresses:
|
||||||
reactor.listenTCP(
|
reactor.listenTCP(
|
||||||
port,
|
port,
|
||||||
@ -154,11 +150,7 @@ class PusherServer(HomeServer):
|
|||||||
if listener["type"] == "http":
|
if listener["type"] == "http":
|
||||||
self._listen_http(listener)
|
self._listen_http(listener)
|
||||||
elif listener["type"] == "manhole":
|
elif listener["type"] == "manhole":
|
||||||
bind_address = listener.get("bind_address", None)
|
bind_addresses = listener["bind_addresses"]
|
||||||
bind_addresses = listener.get("bind_addresses", [])
|
|
||||||
|
|
||||||
if bind_address is not None:
|
|
||||||
bind_addresses.append(bind_address)
|
|
||||||
|
|
||||||
for address in bind_addresses:
|
for address in bind_addresses:
|
||||||
reactor.listenTCP(
|
reactor.listenTCP(
|
||||||
|
@ -289,8 +289,7 @@ class SynchrotronServer(HomeServer):
|
|||||||
|
|
||||||
def _listen_http(self, listener_config):
|
def _listen_http(self, listener_config):
|
||||||
port = listener_config["port"]
|
port = listener_config["port"]
|
||||||
bind_address = listener_config.get("bind_address", None)
|
bind_addresses = listener_config["bind_addresses"]
|
||||||
bind_addresses = listener_config.get("bind_addresses", [])
|
|
||||||
site_tag = listener_config.get("tag", port)
|
site_tag = listener_config.get("tag", port)
|
||||||
resources = {}
|
resources = {}
|
||||||
for res in listener_config["resources"]:
|
for res in listener_config["resources"]:
|
||||||
@ -312,9 +311,6 @@ class SynchrotronServer(HomeServer):
|
|||||||
|
|
||||||
root_resource = create_resource_tree(resources, Resource())
|
root_resource = create_resource_tree(resources, Resource())
|
||||||
|
|
||||||
if bind_address is not None:
|
|
||||||
bind_addresses.append(bind_address)
|
|
||||||
|
|
||||||
for address in bind_addresses:
|
for address in bind_addresses:
|
||||||
reactor.listenTCP(
|
reactor.listenTCP(
|
||||||
port,
|
port,
|
||||||
@ -334,11 +330,7 @@ class SynchrotronServer(HomeServer):
|
|||||||
if listener["type"] == "http":
|
if listener["type"] == "http":
|
||||||
self._listen_http(listener)
|
self._listen_http(listener)
|
||||||
elif listener["type"] == "manhole":
|
elif listener["type"] == "manhole":
|
||||||
bind_address = listener.get("bind_address", None)
|
bind_addresses = listener["bind_addresses"]
|
||||||
bind_addresses = listener.get("bind_addresses", [])
|
|
||||||
|
|
||||||
if bind_address is not None:
|
|
||||||
bind_addresses.append(bind_address)
|
|
||||||
|
|
||||||
for address in bind_addresses:
|
for address in bind_addresses:
|
||||||
reactor.listenTCP(
|
reactor.listenTCP(
|
||||||
|
@ -42,6 +42,15 @@ class ServerConfig(Config):
|
|||||||
|
|
||||||
self.listeners = config.get("listeners", [])
|
self.listeners = config.get("listeners", [])
|
||||||
|
|
||||||
|
for listener in self.listeners:
|
||||||
|
bind_address = listener.pop("bind_address", None)
|
||||||
|
bind_addresses = listener.setdefault("bind_addresses", [])
|
||||||
|
|
||||||
|
if bind_address:
|
||||||
|
bind_addresses.append(bind_address)
|
||||||
|
elif not bind_addresses:
|
||||||
|
bind_addresses.append('')
|
||||||
|
|
||||||
self.gc_thresholds = read_gc_thresholds(config.get("gc_thresholds", None))
|
self.gc_thresholds = read_gc_thresholds(config.get("gc_thresholds", None))
|
||||||
|
|
||||||
bind_port = config.get("bind_port")
|
bind_port = config.get("bind_port")
|
||||||
@ -54,7 +63,7 @@ class ServerConfig(Config):
|
|||||||
|
|
||||||
self.listeners.append({
|
self.listeners.append({
|
||||||
"port": bind_port,
|
"port": bind_port,
|
||||||
"bind_address": bind_host,
|
"bind_addresses": [bind_host],
|
||||||
"tls": True,
|
"tls": True,
|
||||||
"type": "http",
|
"type": "http",
|
||||||
"resources": [
|
"resources": [
|
||||||
@ -73,7 +82,7 @@ class ServerConfig(Config):
|
|||||||
if unsecure_port:
|
if unsecure_port:
|
||||||
self.listeners.append({
|
self.listeners.append({
|
||||||
"port": unsecure_port,
|
"port": unsecure_port,
|
||||||
"bind_address": bind_host,
|
"bind_addresses": [bind_host],
|
||||||
"tls": False,
|
"tls": False,
|
||||||
"type": "http",
|
"type": "http",
|
||||||
"resources": [
|
"resources": [
|
||||||
@ -92,7 +101,7 @@ class ServerConfig(Config):
|
|||||||
if manhole:
|
if manhole:
|
||||||
self.listeners.append({
|
self.listeners.append({
|
||||||
"port": manhole,
|
"port": manhole,
|
||||||
"bind_address": "127.0.0.1",
|
"bind_addresses": ["127.0.0.1"],
|
||||||
"type": "manhole",
|
"type": "manhole",
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -100,7 +109,7 @@ class ServerConfig(Config):
|
|||||||
if metrics_port:
|
if metrics_port:
|
||||||
self.listeners.append({
|
self.listeners.append({
|
||||||
"port": metrics_port,
|
"port": metrics_port,
|
||||||
"bind_address": config.get("metrics_bind_host", "127.0.0.1"),
|
"bind_addresses": [config.get("metrics_bind_host", "127.0.0.1")],
|
||||||
"tls": False,
|
"tls": False,
|
||||||
"type": "http",
|
"type": "http",
|
||||||
"resources": [
|
"resources": [
|
||||||
|
Loading…
Reference in New Issue
Block a user