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.

authored by

Kirill Elagin and committed by
Bjørn Forsman
a4afd525 799f149b

+3 -1
+3 -1
nixos/modules/services/monitoring/prometheus/default.nix
··· 629 629 config = mkIf cfg.enable { 630 630 assertions = [ 631 631 ( let 632 - legacy = builtins.match "(.*):(.*)" cfg.listenAddress; 632 + # Match something with dots (an IPv4 address) or something ending in 633 + # a square bracket (an IPv6 addresses) followed by a port number. 634 + legacy = builtins.match "(.*\\..*|.*]):([[:digit:]]+)" cfg.listenAddress; 633 635 in { 634 636 assertion = legacy == null; 635 637 message = ''