summary refs log tree commit diff
path: root/nixos/modules/services/networking/smokeping.nix
diff options
context:
space:
mode:
authorNiklas Hambüchen <mail@nh2.me>2019-01-10 03:48:42 +0100
committerKerstin <kerstin@erictapen.name>2021-11-01 23:20:40 +0100
commit17e4387b38ad35e2ba4fb8101d3cf36ccc14232f (patch)
tree71d3ac4b96d4a1366da60bcc5032540d1239639c /nixos/modules/services/networking/smokeping.nix
parent2760695df0bae341cc7f345593628d9c19af9007 (diff)
downloadnixpkgs-17e4387b38ad35e2ba4fb8101d3cf36ccc14232f.tar
nixpkgs-17e4387b38ad35e2ba4fb8101d3cf36ccc14232f.tar.gz
nixpkgs-17e4387b38ad35e2ba4fb8101d3cf36ccc14232f.tar.bz2
nixpkgs-17e4387b38ad35e2ba4fb8101d3cf36ccc14232f.tar.lz
nixpkgs-17e4387b38ad35e2ba4fb8101d3cf36ccc14232f.tar.xz
nixpkgs-17e4387b38ad35e2ba4fb8101d3cf36ccc14232f.tar.zst
nixpkgs-17e4387b38ad35e2ba4fb8101d3cf36ccc14232f.zip
nixos/smokeping: Make default imgUrl relative.
This avoids a common problem:

Until now, port forwarding to multiple hosts running smokeping did not work;
they all show the data of the first smokeping instance.
That ws because the image URLs generated by smokeping are absolute
(`imgurl` setting).
Consequently, if you ran
  ssh node-1 -L 8081:localhost:8081
  ssh node-2 -L 8081:localhost:8082
  ssh node-3 -L 8081:localhost:8083
and try to open http://localhost:8081, http://localhost:8082 and
http://localhost:8083, they all would show the images of node-1!

Using a relative `imgurl` fixes that.
As per smokeping docs on `imgurl`:

> Either an absolute URL to the `imgcache` directory or one relative to the
> directory where you keep the SmokePing cgi.
Diffstat (limited to 'nixos/modules/services/networking/smokeping.nix')
-rw-r--r--nixos/modules/services/networking/smokeping.nix11
1 files changed, 8 insertions, 3 deletions
diff --git a/nixos/modules/services/networking/smokeping.nix b/nixos/modules/services/networking/smokeping.nix
index 8b13e36c6f3..675da281c91 100644
--- a/nixos/modules/services/networking/smokeping.nix
+++ b/nixos/modules/services/networking/smokeping.nix
@@ -131,10 +131,15 @@ in
       };
       imgUrl = mkOption {
         type = types.str;
-        default = "http://${cfg.hostName}:${toString cfg.port}/cache";
-        defaultText = literalExpression ''"http://''${hostName}:''${toString port}/cache"'';
+        default = "cache";
+        defaultText = literalExpression ''"cache"'';
         example = "https://somewhere.example.com/cache";
-        description = "Base url for images generated in the cgi.";
+        description = ''
+          Base url for images generated in the cgi.
+
+          The default is a relative URL to ensure it works also when e.g. forwarding
+          the GUI port via SSH.
+        '';
       };
       linkStyle = mkOption {
         type = types.enum ["original" "absolute" "relative"];