nixos/prometheus-mail-exporter: fix assertion
The assertion was printed when user explicitly defined only the configFile option.
This commit is contained in:
parent
2a080ac434
commit
3b5cf35e8b
2 changed files with 6 additions and 4 deletions
|
@ -205,7 +205,9 @@ in
|
||||||
or `services.prometheus.exporters.snmp.configurationPath' set!
|
or `services.prometheus.exporters.snmp.configurationPath' set!
|
||||||
'';
|
'';
|
||||||
} {
|
} {
|
||||||
assertion = (cfg.mail.configFile == null) != (cfg.mail.configuration == {});
|
assertion = cfg.mail.enable -> (
|
||||||
|
(cfg.mail.configFile == null) != (cfg.mail.configuration == null)
|
||||||
|
);
|
||||||
message = ''
|
message = ''
|
||||||
Please specify either 'services.prometheus.exporters.mail.configuration'
|
Please specify either 'services.prometheus.exporters.mail.configuration'
|
||||||
or 'services.prometheus.exporters.mail.configFile'.
|
or 'services.prometheus.exporters.mail.configFile'.
|
||||||
|
|
|
@ -127,8 +127,8 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
configuration = mkOption {
|
configuration = mkOption {
|
||||||
type = types.submodule exporterOptions;
|
type = types.nullOr (types.submodule exporterOptions);
|
||||||
default = {};
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
Specify the mailexporter configuration file to use.
|
Specify the mailexporter configuration file to use.
|
||||||
'';
|
'';
|
||||||
|
@ -148,7 +148,7 @@ in
|
||||||
${pkgs.prometheus-mail-exporter}/bin/mailexporter \
|
${pkgs.prometheus-mail-exporter}/bin/mailexporter \
|
||||||
--web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
|
--web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
|
||||||
--config.file ${
|
--config.file ${
|
||||||
if cfg.configuration != {} then configurationFile else (escapeShellArg cfg.configFile)
|
if cfg.configuration != null then configurationFile else (escapeShellArg cfg.configFile)
|
||||||
} \
|
} \
|
||||||
${concatStringsSep " \\\n " cfg.extraFlags}
|
${concatStringsSep " \\\n " cfg.extraFlags}
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Reference in a new issue