mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 14:54:29 +01:00
nixos/prometheus-exporters/wireguard: add support for -s
switch
Since version 3.0 all allowed IPs and subnets are exposed by the exporter. With `-s` set on the CLI, instead of a comma-separated list, each allowed IP and subnet will be in a single field with the schema `allowed_ip_<index>`.
This commit is contained in:
parent
543ef567d9
commit
7095bdf988
1 changed files with 12 additions and 0 deletions
|
@ -23,12 +23,24 @@ in {
|
|||
to set the peers up.
|
||||
'';
|
||||
};
|
||||
|
||||
singleSubnetPerField = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
By default, all allowed IPs and subnets are comma-separated in the
|
||||
<literal>allowed_ips</literal> field. With this option enabled,
|
||||
a single IP and subnet will be listed in fields like <literal>allowed_ip_0</literal>,
|
||||
<literal>allowed_ip_1</literal> and so on.
|
||||
'';
|
||||
};
|
||||
};
|
||||
serviceOpts = {
|
||||
script = ''
|
||||
${pkgs.prometheus-wireguard-exporter}/bin/prometheus_wireguard_exporter \
|
||||
-p ${toString cfg.port} \
|
||||
${optionalString cfg.verbose "-v"} \
|
||||
${optionalString cfg.singleSubnetPerField "-s"} \
|
||||
${optionalString (cfg.wireguardConfig != null) "-n ${cfg.wireguardConfig}"}
|
||||
'';
|
||||
|
||||
|
|
Loading…
Reference in a new issue