0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 13:40:28 +03:00

nixos/prometheus-exporters/fastly: fix secret handling

The exporter expects the token as an environment variable, not a path
to the file containing the token.
This commit is contained in:
Martin Weinelt 2025-01-04 17:48:56 +01:00
parent b25a2b5ff4
commit 62f35da2a1
No known key found for this signature in database
GPG key ID: 87C1E9888F856759
2 changed files with 5 additions and 6 deletions

View file

@ -31,18 +31,17 @@ in
'';
};
tokenPath = mkOption {
environmentFile = mkOption {
type = path;
description = ''
A run-time path to the token file, which is supposed to be provisioned
outside of Nix store.
An environment file containg at least the FASTLY_API_TOKEN= environment
variable.
'';
};
};
serviceOpts = {
serviceConfig = {
LoadCredential = "fastly-api-token:${cfg.tokenPath}";
Environment = [ "FASTLY_API_TOKEN=%d/fastly-api-token" ];
EnvironmentFile = cfg.environmentFile;
ExecStart = escapeSystemdExecArgs (
[
(getExe pkgs.prometheus-fastly-exporter)

View file

@ -399,7 +399,7 @@ let
fastly = {
exporterConfig = {
enable = true;
tokenPath = pkgs.writeText "token" "abc123";
environmentFile = pkgs.writeText "fastly-exporter-env" "FASTLY_API_TOKEN=abc123";
};
exporterTest = ''