From 101b3994a70f2228fa1405502522a8cfa54c5380 Mon Sep 17 00:00:00 2001 From: niten Date: Sun, 28 Jul 2024 13:13:04 -0700 Subject: [PATCH] Don't add empty clauses --- lib/fudo/prometheus.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/fudo/prometheus.nix b/lib/fudo/prometheus.nix index 6faacbd..9e42f71 100644 --- a/lib/fudo/prometheus.nix +++ b/lib/fudo/prometheus.nix @@ -154,10 +154,11 @@ in { honor_labels = false; scheme = if secured then "https" else "http"; metrics_path = path; - static_configs = - let attachPort = target: "${target}:${toString port}"; - in [{ targets = map attachPort static-targets; }]; - dns_sd_configs = [{ names = dns-sd-records; }]; + static_configs = mkif (static-targets != [ ]) + (let attachPort = target: "${target}:${toString port}"; + in [{ targets = map attachPort static-targets; }]); + dns_sd_configs = + mkIf (dns-sd-records != [ ]) [{ names = dns-sd-records; }]; }; in map mkScraper cfg.scrapers;