Skip to content

Commit

Permalink
prometheus: Unbreak IPv6 listenAddress
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kirelagin authored and bjornfor committed Sep 21, 2020
1 parent 799f149 commit a4afd52
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nixos/modules/services/monitoring/prometheus/default.nix
Expand Up @@ -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 = ''
Expand Down

0 comments on commit a4afd52

Please sign in to comment.