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
@ -23,12 +23,24 @@ in {
|
|||||||
to set the peers up.
|
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 = {
|
serviceOpts = {
|
||||||
script = ''
|
script = ''
|
||||||
${pkgs.prometheus-wireguard-exporter}/bin/prometheus_wireguard_exporter \
|
${pkgs.prometheus-wireguard-exporter}/bin/prometheus_wireguard_exporter \
|
||||||
-p ${toString cfg.port} \
|
-p ${toString cfg.port} \
|
||||||
${optionalString cfg.verbose "-v"} \
|
${optionalString cfg.verbose "-v"} \
|
||||||
|
${optionalString cfg.singleSubnetPerField "-s"} \
|
||||||
${optionalString (cfg.wireguardConfig != null) "-n ${cfg.wireguardConfig}"}
|
${optionalString (cfg.wireguardConfig != null) "-n ${cfg.wireguardConfig}"}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user