git.iko.soy/typeable/nixpkgs
on master help sign in
prometheus: Add assert for legacy listenAddress
commite1d80de838d31bd1f05369120ecd7d4b191e9f9c authorKirill Elagin <kirelagin@gmail.com> dateThu 23 Jul 2020, 18:16 (6 years ago) parent5d2a465
1 file changed+15
nixos/modules/services/monitoring/prometheus/default.nix+15
nixos/modules/services/monitoring/prometheus/default.nix+15
@@ -627,6 +627,21 @@ in {
627627 };
628628
629629 config = mkIf cfg.enable {
630+ assertions = [
631+ ( let
632+ legacy = builtins.match "(.*):(.*)" cfg.listenAddress;
633+ in {
634+ assertion = legacy == null;
635+ message = ''
636+ Do not specify the port for Prometheus to listen on in the
637+ listenAddress option; use the port option instead:
638+ services.prometheus.listenAddress = ${builtins.elemAt legacy 0};
639+ services.prometheus.port = ${builtins.elemAt legacy 1};
640+ '';
641+ }
642+ )
643+ ];
644+
630645 users.groups.prometheus.gid = config.ids.gids.prometheus;
631646 users.users.prometheus = {
632647 description = "Prometheus daemon user";