21 lines
672 B
Nix
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)
|
|
];
|
|
}
|