feat(matrix-synapse): enable metrics #100

Merged
teutat3s merged 4 commits from feat/synapse-metrics into main 2024-01-28 23:56:42 +00:00
Showing only changes of commit 62429bca08 - Show all commits

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"

This looks like it will break if someone adds things as the first element of that list. We should filter for the service which contains federation in names.

This looks like it will break if someone adds things as the first element of that list. We should filter for the service which contains `federation` in `names`.
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;
};