matrixsynapse: Update old STUN URIs to remove 'transport' parameter

- If the STUN/TURN configuration is not managed by FreedomBox, the parameters
are left unchanged.

Tests:

- Install app after installing Coturn. Notice that STUN URI doesn't have a
'transport' parameter.

- Install app without the patches after installing Coturn. Notice that STUN URIs
have 'transport' parameter. Then apply patches. Setup is run. 'transport'
parameter is removed and only one STUN URI is present. matrix-synapse server
restarts successfully and don't have show any errors/warnings regarding
STUN/TURN configuration during startup.

- Install app without patches and set custom STUN/TURN URIs. Apply patches.
Setup is run. The URIs are not changed.

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2023-11-04 10:09:50 -07:00 committed by James Valleroy
parent e6e6896d0d
commit e42740b589
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -44,7 +44,7 @@ class MatrixSynapseApp(app_module.App):
app_id = 'matrixsynapse'
_version = 9
_version = 10
def __init__(self):
"""Create components for the app."""
@ -129,9 +129,14 @@ class MatrixSynapseApp(app_module.App):
self.get_component('letsencrypt-matrixsynapse').setup_certificates()
# Configure STUN/TURN only if there's a valid TLS domain set for Coturn
config = self.get_component('turn-matrixsynapse').get_configuration()
update_turn_configuration(config, force=True)
if not old_version or get_turn_configuration()[1]:
# Configure STUN/TURN only if there's a valid TLS domain set for
# Coturn. Do this if app is being freshly installed or if it is
# previously installed and configured to use STUN/TURN
# auto-management.
config = self.get_component(
'turn-matrixsynapse').get_configuration()
update_turn_configuration(config, force=True)
def uninstall(self):
"""De-configure and uninstall the app."""