summary refs log tree commit diff
path: root/host/Rory-nginx/services/matrix/synapse/workers/federation-inbound.nix
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2024-08-16 14:39:37 +0200
committerRory& <root@rory.gay>2024-08-16 14:39:37 +0200
commit4a60627f7f5f4e6a64a93635bd0df2c7f6b2cd17 (patch)
tree8159e19ce6762e40f538a9a40f11b05eb4da7d09 /host/Rory-nginx/services/matrix/synapse/workers/federation-inbound.nix
parentUnify single workers (diff)
downloadRory-Open-Architecture-4a60627f7f5f4e6a64a93635bd0df2c7f6b2cd17.tar.xz
Start reworking other workers
Diffstat (limited to 'host/Rory-nginx/services/matrix/synapse/workers/federation-inbound.nix')
-rw-r--r--host/Rory-nginx/services/matrix/synapse/workers/federation-inbound.nix37
1 files changed, 26 insertions, 11 deletions
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/federation-inbound.nix b/host/Rory-nginx/services/matrix/synapse/workers/federation-inbound.nix
index 03f5576..4ea5aa2 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/federation-inbound.nix
+++ b/host/Rory-nginx/services/matrix/synapse/workers/federation-inbound.nix
@@ -3,11 +3,13 @@
 let
   cfg = config.services.matrix-synapse;
   dbGroup = "medium";
-  hasClientResource = false;
-  hasFederationResource = false;
   workers = lib.range 0 (cfg.federationReaders - 1);
   workerName = "federation_inbound";
-  workerRoutes = [ "~ /_matrix/federation/(v1|v2)/send/" ];
+  workerRoutes = {
+    client = [ ];
+    federation = [ "~ /_matrix/federation/(v1|v2)/send/" ];
+    media = [ ];
+  };
 in
 {
   config = lib.mkIf (cfg.federationInboundWorkers > 0) {
@@ -77,13 +79,26 @@ in
       );
     };
 
-    services.nginx.virtualHosts."${cfg.nginxVirtualHostName}".locations = lib.listToAttrs (
-      lib.map (route: {
-        name = route;
-        value = {
-          proxyPass = "http://${workerName}";
-        };
-      }) workerRoutes
-    );
+    services.nginx = {
+      virtualHosts."${cfg.nginxVirtualHostName}".locations = lib.listToAttrs (
+        lib.flatten (
+          lib.forEach
+            [
+              "client"
+              "federation"
+              "media"
+            ]
+            (
+              type:
+              lib.map (route: {
+                name = route;
+                value = {
+                  proxyPass = "http://unix:/run/matrix-synapse/${workerName}-${type}.sock";
+                };
+              }) workerRoutes.${type}
+            )
+        )
+      );
+    };
   };
 }