fix(matrix-synapse): make sure to find element in

list of config.services.matrix-synapse.settings.listeners.*.resources
that sets names = "client" instead of just using the first element in the list of listeners
This commit is contained in:
teutat3s 2024-01-27 20:23:03 +01:00
parent 3cfdd9d20a
commit 62429bca08
Signed by: teutat3s
GPG key ID: 4FA1D3FA524F22C1

View file

@ -1,7 +1,16 @@
{ config, lib, pkgs, ... }:
let
# Get port from first element in list of matrix-synapse listeners
synapsePort = "${toString (lib.findFirst (listener: listener.port != null) "" config.services.matrix-synapse.settings.listeners).port}";
# Find element in list config.services.matrix-synapse.settings.listeners.*.resources
# that sets names = "client"
nameHasClient = name: name == "client";
resourceHasClient = resource: builtins.any nameHasClient resource.names;
listenerWithClient = lib.findFirst
(listener:
builtins.any resourceHasClient listener.resources)
(throw "Found no matrix-synapse.settings.listeners.*.resources.*.names containing string client")
config.services.matrix-synapse.settings.listeners
;
synapseClientPort = "${toString listenerWithClient.port}";
in
{
systemd.services.matrix-appservice-irc.serviceConfig.SystemCallFilter = lib.mkForce [
@ -17,7 +26,7 @@ in
settings = {
homeserver = {
domain = "pub.solar";
url = "http://127.0.0.1:${synapsePort}";
url = "http://127.0.0.1:${synapseClientPort}";
media_url = "https://matrix.pub.solar";
enablePresence = false;
};