infra/modules/nginx-prometheus-exporters/default.nix
teutat3s e93a56e594
All checks were successful
Flake checks / Check (pull_request) Successful in 4m0s
nginx: use square brackets for IPv6 address
2024-06-05 01:59:54 +02:00

32 lines
901 B
Nix

{
config,
flake,
lib,
...
}:
let
# Find element in list config.services.matrix-synapse.settings.listeners
# that sets type = "metrics"
listenerWithMetrics =
lib.findFirst (listener: listener.type == "metrics")
(throw "Found no matrix-synapse.settings.listeners.*.type containing string metrics")
config.services.matrix-synapse.settings.listeners;
synapseMetricsPort = "${toString listenerWithMetrics.port}";
in
{
services.nginx.virtualHosts = {
"nachtigall.wg.${config.pub-solar-os.networking.domain}" = {
listenAddresses = [
"10.7.6.1"
"[fd00:fae:fae:fae:fae:1::]"
];
locations."/metrics" = {
proxyPass = "http://127.0.0.1:${toString (config.services.prometheus.exporters.node.port)}";
};
locations."/_synapse/metrics" = {
proxyPass = "http://127.0.0.1:${synapseMetricsPort}";
};
};
};
}