From b3f9c69b9369016a2f83d56ae48c12c8dcb21afa Mon Sep 17 00:00:00 2001 From: Tobias Reisinger <tobias@msrg.cc> Date: Fri, 18 Apr 2025 13:43:50 +0200 Subject: [PATCH] Add ability to disable services --- dns/functions.js | 4 ++++ playbooks/filter_plugins/gatus.py | 1 + scripts/visualize.py | 2 ++ services.auto.tfvars | 4 ++-- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dns/functions.js b/dns/functions.js index 52922cb..d891b4f 100644 --- a/dns/functions.js +++ b/dns/functions.js @@ -6,6 +6,10 @@ function service(target, domain, host, alias, vpn) { alias: alias, vpn: vpn, record: function() { + var resolved_host = this.resolve_host(); + if (!resolved_host) { + return []; + } return my_host_record(this.target, this.resolve_host(), this.vpn); }, resolve_host: function() { diff --git a/playbooks/filter_plugins/gatus.py b/playbooks/filter_plugins/gatus.py index 1eb3ceb..b5076c3 100644 --- a/playbooks/filter_plugins/gatus.py +++ b/playbooks/filter_plugins/gatus.py @@ -72,6 +72,7 @@ class FilterModule(object): new_endpoint = { "name": name, + "enabled": bool(service.get("host")), "group": mon.get("group"), "url": url, "conditions": conditions, diff --git a/scripts/visualize.py b/scripts/visualize.py index 3f4cddd..934594d 100755 --- a/scripts/visualize.py +++ b/scripts/visualize.py @@ -87,6 +87,8 @@ def parse_services(services, hosts): for host in hosts.keys(): data["host"] = host result.append(parse_service(svc, data, hosts)) + elif not data["host"]: + continue else: result.append(parse_service(svc, data, hosts)) diff --git a/services.auto.tfvars b/services.auto.tfvars index be7a9d8..925d86a 100644 --- a/services.auto.tfvars +++ b/services.auto.tfvars @@ -750,7 +750,7 @@ services = { }, "wiki_js" = { - host = "node001" + host = "" dns = [{ domain = "wiki.serguzim.me" }] @@ -765,7 +765,7 @@ services = { }, "woodpecker" = { - host = "node001" + host = "" dns = [ { domain = "ci.serguzim.me"