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.
main
Niklas Hambüchen 5 years ago committed by Kerstin
parent 2760695df0
commit 17e4387b38
  1. 11
      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"];

Loading…
Cancel
Save