Set default config value for tests

This commit is contained in:
Andrew Morgan 2019-01-17 13:23:16 +00:00
parent 53f8936b40
commit 8b0a9b3ad7
3 changed files with 8 additions and 6 deletions

View file

@ -108,17 +108,17 @@ class ServerConfig(Config):
"federation_domain_whitelist", None
)
# Optional proxy address for federation traffic
self.federation_request_gateway_addr = config.get(
"federation_request_gateway_addr", None
)
# turn the whitelist into a hash for speed of lookup
if federation_domain_whitelist is not None:
self.federation_domain_whitelist = {}
for domain in federation_domain_whitelist:
self.federation_domain_whitelist[domain] = True
# Optional proxy address for federation traffic
self.federation_request_gateway_addr = config.get(
"federation_request_gateway_addr", None
)
if self.federation_request_gateway_addr is not None:
# Ensure proxy address is correctly formatted
if len(self.federation_request_gateway_addr.split(':')) != 2:

View file

@ -69,10 +69,11 @@ class ProxyMatrixFederationEndpointFactory(object):
def __init__(self, hs):
self.reactor = hs.get_reactor()
self.tls_client_options_factory = hs.tls_client_options_factory
self.gateway_addr = hs.config.federation_request_gateway_addr
def endpointForURI(self, uri):
return matrix_federation_endpoint(
self.reactor, self.hs.config.federation_request_gateway_addr, timeout=10,
self.reactor, self.gateway_addr, timeout=10,
tls_client_options_factory=None
)

View file

@ -115,6 +115,7 @@ def default_config(name):
config.email_enable_notifs = False
config.block_non_admin_invites = False
config.federation_domain_whitelist = None
config.federation_request_gateway_addr = None
config.federation_rc_reject_limit = 10
config.federation_rc_sleep_limit = 10
config.federation_rc_sleep_delay = 100