Deduce gatus endpoint group from domain when possible

This commit is contained in:
SebastianStork 2025-06-20 22:17:54 +02:00
parent efe6da5582
commit dbe87bc88a
7 changed files with 11 additions and 20 deletions

View file

@ -26,9 +26,6 @@ in
};
};
custom.services.gatus.endpoints."Actual Budget" = {
group = "Private";
url = "https://${cfg.domain}/";
};
custom.services.gatus.endpoints."Actual Budget".url = "https://${cfg.domain}/";
};
}

View file

@ -96,14 +96,10 @@ in
custom.services.gatus.endpoints = {
"Forgejo" = {
group = "Public";
url = "https://${cfg.domain}/api/healthz";
extraConditions = [ "[BODY].status == pass" ];
};
"Forgejo SSH" = {
group = "Public";
url = "ssh://${cfg.domain}";
};
"Forgejo SSH".url = "ssh://${cfg.domain}";
};
};
}

View file

@ -29,8 +29,8 @@ in
default = name;
};
group = lib.mkOption {
type = lib.types.str;
default = "";
type = lib.types.nullOr lib.types.str;
default = null;
};
url = lib.mkOption {
type = lib.types.nonEmptyStr;
@ -101,8 +101,13 @@ in
url,
extraConditions,
}:
let
isPrivate = lib.hasInfix config.custom.services.tailscale.domain url;
deducedGroup = if isPrivate then "Private" else "Public";
in
{
inherit name group url;
inherit name url;
group = if group == null then deducedGroup else group;
interval = "30s";
alerts = [ { type = "ntfy"; } ];
ssh = lib.mkIf (lib.hasPrefix "ssh" url) {

View file

@ -81,7 +81,6 @@ in
environment.shellAliases.hedgedoc-manage-users = "sudo --user=${user} ${manage_users}";
custom.services.gatus.endpoints."Hedgedoc" = {
group = "Public";
url = "https://${cfg.domain}/_health";
extraConditions = [ "[BODY].ready == true" ];
};

View file

@ -31,7 +31,6 @@ in
};
custom.services.gatus.endpoints."IT Tools" = {
group = "Public";
url = "https://${cfg.domain}/health";
extraConditions = [ "[BODY] == OK" ];
};

View file

@ -74,7 +74,6 @@ in
};
custom.services.gatus.endpoints."Nextcloud" = {
group = "Private";
url = "https://${cfg.domain}/status.php";
extraConditions = [
"[BODY].installed == true"

View file

@ -99,12 +99,8 @@ in
};
custom.services.gatus.endpoints = lib.mkIf cfg.isServer {
"Syncthing" = {
group = "Private";
url = "tcp://${config.networking.hostName}.${tailscaleCfg.domain}:22000";
};
"Syncthing".url = "tcp://${config.networking.hostName}.${tailscaleCfg.domain}:22000";
"Syncthing GUI" = {
group = "Private";
url = "https://${cfg.gui.domain}/rest/noauth/health";
extraConditions = [ "[BODY].status == OK" ];
};