hosts/public-access-proxy: add assertion for haproxy backend

This commit is contained in:
Markus Schmidl 2023-04-18 22:07:17 +02:00
parent dd73d8ae9c
commit bd2a66113b
1 changed files with 9 additions and 0 deletions

View File

@ -97,6 +97,15 @@ in
};
config = lib.mkIf cfg.enable {
assertions = [{
assertion = let
proxyTo = lib.forEach cfg.proxyHosts (x: x.proxyTo.host);
uniqueProxyTo = lib.unique proxyTo;
in
(builtins.length proxyTo) == (builtins.length uniqueProxyTo);
message = "proxyTo must be unique across the list of proxyHosts. Insert your domain you want to proxy to the list of hostNames instead.";
}];
services.haproxy = {
enable = true;
config = ''