diff options
author | Rory& <root@rory.gay> | 2024-08-16 14:22:56 +0200 |
---|---|---|
committer | Rory& <root@rory.gay> | 2024-08-16 14:22:56 +0200 |
commit | b305a16775934682e736345c5e885010de236cd3 (patch) | |
tree | 86aaab8cc3f22ca9e560427f4454964c87e45293 /host/Rory-nginx/services/matrix/synapse/workers/single/background.nix | |
parent | Some synapse workers cleanup (diff) | |
download | Rory-Open-Architecture-b305a16775934682e736345c5e885010de236cd3.tar.xz |
Unify single workers
Diffstat (limited to 'host/Rory-nginx/services/matrix/synapse/workers/single/background.nix')
-rw-r--r-- | host/Rory-nginx/services/matrix/synapse/workers/single/background.nix | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/single/background.nix b/host/Rory-nginx/services/matrix/synapse/workers/single/background.nix index acc423d..bfa1793 100644 --- a/host/Rory-nginx/services/matrix/synapse/workers/single/background.nix +++ b/host/Rory-nginx/services/matrix/synapse/workers/single/background.nix @@ -6,7 +6,11 @@ let hasClientResource = false; hasFederationResource = false; workerName = "background"; - workerRoutes = [ ]; + workerRoutes = { + client = [ ]; + federation = [ ]; + media = [ ]; + }; in { config = lib.mkIf cfg.enableBackgroundWorker { @@ -37,7 +41,7 @@ in ]; } ] - ++ lib.optional hasClientResource { + ++ lib.optional (lib.length workerRoutes.client > 0) { type = "http"; path = "/run/matrix-synapse/${workerName}-client.sock"; mode = "666"; @@ -48,7 +52,7 @@ in } ]; } - ++ lib.optional hasFederationResource { + ++ lib.optional (lib.length workerRoutes.federation > 0) { type = "http"; path = "/run/matrix-synapse/${workerName}-federation.sock"; mode = "666"; @@ -67,12 +71,23 @@ in services.nginx = { virtualHosts."${cfg.nginxVirtualHostName}".locations = lib.listToAttrs ( - lib.map (route: { - name = route; - value = { - proxyPass = "http://${workerName}"; - }; - }) workerRoutes + 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} + ) + ) ); }; }; |