nixos/prometheus-restic-exporter: Use LoadCredential for password file
This commit is contained in:
parent
e7a2d8aa18
commit
de306fb3d6
@ -93,12 +93,14 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
serviceOpts = {
|
serviceOpts = {
|
||||||
|
script = ''
|
||||||
|
export RESTIC_PASSWORD_FILE=$CREDENTIALS_DIRECTORY/RESTIC_PASSWORD_FILE
|
||||||
|
${pkgs.prometheus-restic-exporter}/bin/restic-exporter.py \
|
||||||
|
${concatStringsSep " \\\n " cfg.extraFlags}
|
||||||
|
'';
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = ''
|
|
||||||
${pkgs.prometheus-restic-exporter}/bin/restic-exporter.py \
|
|
||||||
${concatStringsSep " \\\n " cfg.extraFlags}
|
|
||||||
'';
|
|
||||||
EnvironmentFile = mkIf (cfg.environmentFile != null) cfg.environmentFile;
|
EnvironmentFile = mkIf (cfg.environmentFile != null) cfg.environmentFile;
|
||||||
|
LoadCredential = [ "RESTIC_PASSWORD_FILE:${cfg.passwordFile}" ];
|
||||||
};
|
};
|
||||||
environment =
|
environment =
|
||||||
let
|
let
|
||||||
@ -109,7 +111,6 @@ in
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
RESTIC_REPOSITORY = cfg.repository;
|
RESTIC_REPOSITORY = cfg.repository;
|
||||||
RESTIC_PASSWORD_FILE = cfg.passwordFile;
|
|
||||||
LISTEN_ADDRESS = cfg.listenAddress;
|
LISTEN_ADDRESS = cfg.listenAddress;
|
||||||
LISTEN_PORT = toString cfg.port;
|
LISTEN_PORT = toString cfg.port;
|
||||||
REFRESH_INTERVAL = toString cfg.refreshInterval;
|
REFRESH_INTERVAL = toString cfg.refreshInterval;
|
||||||
|
Loading…
Reference in New Issue
Block a user