nginx: make upstream generator check empty attrset rather than empty list

This commit is contained in:
Daniel Lovbrotte Olsen 2022-12-19 21:04:15 +01:00
parent 43dbc17526
commit f42306e0a2
1 changed files with 4 additions and 4 deletions

View File

@ -153,7 +153,7 @@ in
servers = let servers = let
fedReceivers = getWorkersOfType "fed-receiver"; fedReceivers = getWorkersOfType "fed-receiver";
socketAddresses = generateSocketAddresses "federation" fedReceivers; socketAddresses = generateSocketAddresses "federation" fedReceivers;
in if fedReceivers != [ ] then in if fedReceivers != { } then
lib.genAttrs socketAddresses (_: { }) lib.genAttrs socketAddresses (_: { })
else config.services.nginx.upstreams.synapse_master.servers; else config.services.nginx.upstreams.synapse_master.servers;
extraConfig = '' extraConfig = ''
@ -166,7 +166,7 @@ in
servers = let servers = let
initialSyncers = getWorkersOfType "initial-sync"; initialSyncers = getWorkersOfType "initial-sync";
socketAddresses = generateSocketAddresses "client" initialSyncers; socketAddresses = generateSocketAddresses "client" initialSyncers;
in if initialSyncers != [ ] then in if initialSyncers != { } then
lib.genAttrs socketAddresses (_: { }) lib.genAttrs socketAddresses (_: { })
else config.services.nginx.upstreams.synapse_master.servers; else config.services.nginx.upstreams.synapse_master.servers;
extraConfig = '' extraConfig = ''
@ -179,7 +179,7 @@ in
servers = let servers = let
normalSyncers = getWorkersOfType "normal-sync"; normalSyncers = getWorkersOfType "normal-sync";
socketAddresses = generateSocketAddresses "client" normalSyncers; socketAddresses = generateSocketAddresses "client" normalSyncers;
in if normalSyncers != [ ] then in if normalSyncers != { } then
lib.genAttrs socketAddresses (_: { }) lib.genAttrs socketAddresses (_: { })
else config.services.nginx.upstreams.synapse_master.servers; else config.services.nginx.upstreams.synapse_master.servers;
extraConfig = '' extraConfig = ''
@ -192,7 +192,7 @@ in
servers = let servers = let
workers = getWorkersOfType "user-dir"; workers = getWorkersOfType "user-dir";
socketAddresses = generateSocketAddresses "client" workers; socketAddresses = generateSocketAddresses "client" workers;
in if workers != [ ] then in if workers != { } then
lib.genAttrs socketAddresses (_: { }) lib.genAttrs socketAddresses (_: { })
else config.services.nginx.upstreams.synapse_master.servers; else config.services.nginx.upstreams.synapse_master.servers;
}; };