From 17e4387b38ad35e2ba4fb8101d3cf36ccc14232f Mon Sep 17 00:00:00 2001 From: Niklas Hambüchen Date: Thu, 10 Jan 2019 03:48:42 +0100 Subject: 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. --- nixos/modules/services/networking/smokeping.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'nixos/modules/services/networking/smokeping.nix') 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"]; -- cgit 1.4.1