summary refs log tree commit diff
path: root/nixos/modules/services/monitoring/prometheus/default.nix
diff options
context:
space:
mode:
authorKirill Elagin <kirelagin@gmail.com>2020-09-20 17:38:46 -0400
committerBjørn Forsman <bjorn.forsman@gmail.com>2020-09-21 07:53:47 +0200
commita4afd525cb9ab90b71977142489ac154a701b7d0 (patch)
treec27f90fa80a692a721175c6c6e6e366bfe4f48aa /nixos/modules/services/monitoring/prometheus/default.nix
parent799f149bbff72426c5cf47f363f712801a1ae108 (diff)
downloadnixpkgs-a4afd525cb9ab90b71977142489ac154a701b7d0.tar
nixpkgs-a4afd525cb9ab90b71977142489ac154a701b7d0.tar.gz
nixpkgs-a4afd525cb9ab90b71977142489ac154a701b7d0.tar.bz2
nixpkgs-a4afd525cb9ab90b71977142489ac154a701b7d0.tar.lz
nixpkgs-a4afd525cb9ab90b71977142489ac154a701b7d0.tar.xz
nixpkgs-a4afd525cb9ab90b71977142489ac154a701b7d0.tar.zst
nixpkgs-a4afd525cb9ab90b71977142489ac154a701b7d0.zip
prometheus: Unbreak IPv6 listenAddress
The format of the listenAddress option was recently changed to separate
the address and the port parts. There is now a legacy check that
tells users to update to the new format. This legacy check produces
a false positive on IPv6 addresses, since they contain colons.

Fix the regex to make it not match colons within IPv6 addresses.
Diffstat (limited to 'nixos/modules/services/monitoring/prometheus/default.nix')
-rw-r--r--nixos/modules/services/monitoring/prometheus/default.nix4
1 files changed, 3 insertions, 1 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/default.nix b/nixos/modules/services/monitoring/prometheus/default.nix
index d7e06484b69..bfd4951ef48 100644
--- a/nixos/modules/services/monitoring/prometheus/default.nix
+++ b/nixos/modules/services/monitoring/prometheus/default.nix
@@ -629,7 +629,9 @@ in {
   config = mkIf cfg.enable {
     assertions = [
       ( let
-          legacy = builtins.match "(.*):(.*)" cfg.listenAddress;
+          # Match something with dots (an IPv4 address) or something ending in
+          # a square bracket (an IPv6 addresses) followed by a port number.
+          legacy = builtins.match "(.*\\..*|.*]):([[:digit:]]+)" cfg.listenAddress;
         in {
           assertion = legacy == null;
           message = ''