From 522ca13e808d4f38ca8422138d2f4092923fc12a Mon Sep 17 00:00:00 2001 From: tdback Date: Thu, 23 Jan 2025 18:52:12 -0500 Subject: modules: use attribute for matrix port, use defaults for turn uris --- modules/services/matrix/default.nix | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'modules/services/matrix') diff --git a/modules/services/matrix/default.nix b/modules/services/matrix/default.nix index 61bc83b..c6d8755 100644 --- a/modules/services/matrix/default.nix +++ b/modules/services/matrix/default.nix @@ -6,8 +6,9 @@ ... }: let - fqdn = "synapse.${config.networking.domain}"; baseUrl = "https://${fqdn}"; + fqdn = "synapse.${config.networking.domain}"; + synPort = 8008; in { age.secrets = { @@ -89,10 +90,14 @@ in services.caddy = { enable = true; virtualHosts = { - ${fqdn}.extraConfig = '' - reverse_proxy /_matrix/* localhost:8008 - reverse_proxy /_synapse/client/* localhost:8008 - ''; + ${fqdn}.extraConfig = + let + localhost = "http://localhost:${builtins.toString synPort}"; + in + '' + reverse_proxy /_matrix/* ${localhost} + reverse_proxy /_synapse/client/* ${localhost} + ''; }; }; @@ -103,7 +108,7 @@ in server_name = config.networking.domain; public_baseurl = baseUrl; listeners = lib.singleton { - port = 8008; + port = synPort; bind_addresses = [ "::1" ]; type = "http"; tls = false; @@ -117,8 +122,8 @@ in }; }; turn_uris = with config.services.coturn; [ - "turn:${realm}:3487?transport=udp" - "turn:${realm}:3487?transport=tcp" + "turn:${realm}?transport=udp" + "turn:${realm}?transport=tcp" ]; }; }; -- cgit v1.2.3