summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Höppner <christian.hoppner@serokell.io>2020-05-08 23:58:31 +0100
committerChristian Höppner <christian.hoppner@serokell.io>2020-05-19 11:48:44 +0100
commitba3c3de8a6b21eb2a3e2fa29e90e051faf3d643a (patch)
tree5c63d4a5be73fd564906c1611a1eea71f0e06eb2
parent59c9713715645c016d5d733b9c0d0714e35326fa (diff)
downloadnixpkgs-ba3c3de8a6b21eb2a3e2fa29e90e051faf3d643a.tar
nixpkgs-ba3c3de8a6b21eb2a3e2fa29e90e051faf3d643a.tar.gz
nixpkgs-ba3c3de8a6b21eb2a3e2fa29e90e051faf3d643a.tar.bz2
nixpkgs-ba3c3de8a6b21eb2a3e2fa29e90e051faf3d643a.tar.lz
nixpkgs-ba3c3de8a6b21eb2a3e2fa29e90e051faf3d643a.tar.xz
nixpkgs-ba3c3de8a6b21eb2a3e2fa29e90e051faf3d643a.tar.zst
nixpkgs-ba3c3de8a6b21eb2a3e2fa29e90e051faf3d643a.zip
prometheus: Split options listenAddress and port
Accessing the configured port of a service is quite useful, for example
when configuring virtual hosts for a service. The prometheus module did
not expose the configured por separately, making it unnecessarily
cumbersome to consume.

This is a breaking change only if you were setting `listenAddress` to
a non-standard value. If you were, you should now set `listenAddress`
and `port` separately.
-rw-r--r--nixos/modules/services/monitoring/prometheus/default.nix12
1 files changed, 10 insertions, 2 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/default.nix b/nixos/modules/services/monitoring/prometheus/default.nix
index 84a72afac2f..c64ab448e0e 100644
--- a/nixos/modules/services/monitoring/prometheus/default.nix
+++ b/nixos/modules/services/monitoring/prometheus/default.nix
@@ -46,7 +46,7 @@ let
   cmdlineArgs = cfg.extraFlags ++ [
     "--storage.tsdb.path=${workingDir}/data/"
     "--config.file=${prometheusYml}"
-    "--web.listen-address=${cfg.listenAddress}"
+    "--web.listen-address=${cfg.listenAddress}:${builtins.toString cfg.port}"
     "--alertmanager.notification-queue-capacity=${toString cfg.alertmanagerNotificationQueueCapacity}"
     "--alertmanager.timeout=${toString cfg.alertmanagerTimeout}s"
   ] ++
@@ -489,9 +489,17 @@ in {
       '';
     };
 
+    port = mkOption {
+      type = types.int;
+      default = 9090;
+      description = ''
+        Port to listen on.
+      '';
+    };
+
     listenAddress = mkOption {
       type = types.str;
-      default = "0.0.0.0:9090";
+      default = "0.0.0.0";
       description = ''
         Address to listen on for the web interface, API, and telemetry.
       '';