gatus: Small improvements

This commit is contained in:
SebastianStork 2025-09-03 00:01:00 +02:00
parent 6f53e67250
commit e914990eaf

View file

@ -1,7 +1,7 @@
{ config, lib, ... }: { config, lib, ... }:
let let
cfg = config.custom.services.gatus; cfg = config.custom.services.gatus;
tailscaleCfg = config.custom.services.tailscale; tailscaleDomain = config.custom.services.tailscale.domain;
in in
{ {
options.custom.services.gatus = { options.custom.services.gatus = {
@ -30,11 +30,7 @@ in
}; };
group = lib.mkOption { group = lib.mkOption {
type = lib.types.nonEmptyStr; type = lib.types.nonEmptyStr;
default = default = if config.domain |> lib.hasSuffix tailscaleDomain then "Private" else "Public";
let
isTailscale = config.domain |> lib.hasSuffix tailscaleCfg.domain;
in
if isTailscale then "Private" else "Public";
}; };
protocol = lib.mkOption { protocol = lib.mkOption {
type = lib.types.nonEmptyStr; type = lib.types.nonEmptyStr;
@ -87,13 +83,12 @@ in
defaultEndpoints = defaultEndpoints =
cfg.domainsToMonitor cfg.domainsToMonitor
|> lib.filter (domain: domain != cfg.domain) |> lib.filter (domain: domain != cfg.domain)
|> lib.map (domain: lib.nameValuePair (getSubdomain domain) { domain = lib.mkDefault domain; }) |> lib.map (domain: lib.nameValuePair (getSubdomain domain) { inherit domain; })
|> lib.listToAttrs; |> lib.listToAttrs;
in in
{ {
"healthchecks.io" = { "healthchecks.io" = {
group = "Monitoring"; group = "Monitoring";
protocol = "https";
domain = "hc-ping.com"; domain = "hc-ping.com";
path = "/\${HEALTHCHECKS_PING_KEY}/${config.networking.hostName}-gatus-uptime?create=1"; path = "/\${HEALTHCHECKS_PING_KEY}/${config.networking.hostName}-gatus-uptime?create=1";
interval = "2h"; interval = "2h";