From 70806819b13486261723ec9831436df333dc69c6 Mon Sep 17 00:00:00 2001 From: Florian Sesser <florian@private.storage> Date: Thu, 30 Sep 2021 13:02:12 +0000 Subject: [PATCH] Only include the environment file if Slack alerter is enabled --- nixos/modules/monitoring/server/grafana.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nixos/modules/monitoring/server/grafana.nix b/nixos/modules/monitoring/server/grafana.nix index 1d2052dd..d8ed7c12 100644 --- a/nixos/modules/monitoring/server/grafana.nix +++ b/nixos/modules/monitoring/server/grafana.nix @@ -81,7 +81,11 @@ in { # Port 80 for ACME ssl retrieval only. 443 for nginx -> grafana. networking.firewall.allowedTCPPorts = [ 80 443 ]; - systemd.services.grafana.serviceConfig.EnvironmentFile = cfg.grafanaEnvironmentFile; + # We pass the secret Slack URL using an environment variable. + systemd.services.grafana.serviceConfig.EnvironmentFile = + if cfg.enableSlackAlert + then [ cfg.grafanaEnvironmentFile ] + else [ ]; services.grafana = { enable = true; -- GitLab