diff options
author | Arnout Engelen <arnout@bzzt.net> | 2023-07-12 00:32:17 +0200 |
---|---|---|
committer | Arnout Engelen <arnout@bzzt.net> | 2023-07-12 00:32:17 +0200 |
commit | 7e26c8d097778f073c8d975951e226762ec76e84 (patch) | |
tree | f7226e5ec3cb9ad7032df0351272a3f7a56f09ca /nixos/modules/services/monitoring/prometheus/exporters | |
parent | 408c0e8c15a1c9cf5c3226931b6f283c9867c484 (diff) |
prometheus-exporter-nextcloud: support for auth tokens
Fixes #176849
Diffstat (limited to 'nixos/modules/services/monitoring/prometheus/exporters')
-rw-r--r-- | nixos/modules/services/monitoring/prometheus/exporters/nextcloud.nix | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/exporters/nextcloud.nix b/nixos/modules/services/monitoring/prometheus/exporters/nextcloud.nix index 7808c8861a764..28add020f5cc3 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/nextcloud.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/nextcloud.nix @@ -33,6 +33,15 @@ in Make sure that this file is readable by the exporter user. ''; }; + tokenFile = mkOption { + type = types.path; + example = "/path/to/token-file"; + default = ""; + description = lib.mdDoc '' + File containing the token for connecting to Nextcloud. + Make sure that this file is readable by the exporter user. + ''; + }; timeout = mkOption { type = types.str; default = "5s"; @@ -47,12 +56,14 @@ in ExecStart = '' ${pkgs.prometheus-nextcloud-exporter}/bin/nextcloud-exporter \ --addr ${cfg.listenAddress}:${toString cfg.port} \ - --username ${cfg.username} \ --timeout ${cfg.timeout} \ --server ${cfg.url} \ - --password ${escapeShellArg "@${cfg.passwordFile}"} \ - ${concatStringsSep " \\\n " cfg.extraFlags} - ''; + ${if cfg.tokenFile == "" then '' + --username ${cfg.username} \ + --password ${escapeShellArg "@${cfg.passwordFile}"} \ + '' else '' + --auth-token ${escapeShellArg "@${cfg.tokenFile}"} \ + ''} ${concatStringsSep " \\\n " cfg.extraFlags}''; }; }; } |