You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
672 B
Nix

{ http ? [], https ? [], both ? [] }:
{ pkgs, lib, ... }:
{
deployment.healthChecks.http = let
makeHostChecker = { protocol, port }: host: {
scheme = protocol;
port = port;
path = "/";
host = host;
description = "${host} (${protocol} :${toString port}) is up";
};
allHttpHosts = http ++ both;
allHttpsHosts = https ++ both;
generateHttpChecks = hosts: map (makeHostChecker { protocol = "http"; port = 80; }) hosts;
generateHttpsChecks = hosts: map (makeHostChecker { protocol = "https"; port = 443; }) hosts;
in lib.mkMerge [
(generateHttpChecks allHttpHosts)
(generateHttpsChecks allHttpsHosts)
];
}