nixos/services.ddclient: add secretsFile option
This commit is contained in:
committed by
Bjørn Forsman
parent
0da357c342
commit
a1ed19f38d
@@ -19,11 +19,15 @@ let
|
||||
${lib.optionalString (cfg.use == "" && cfg.usev4 != "") "usev4=${cfg.usev4}"}
|
||||
${lib.optionalString (cfg.use == "" && cfg.usev6 != "") "usev6=${cfg.usev6}"}
|
||||
login=${cfg.username}
|
||||
password=${
|
||||
${
|
||||
if cfg.protocol == "nsupdate" then
|
||||
"/run/${RuntimeDirectory}/ddclient.key"
|
||||
else if (cfg.passwordFile != null) then
|
||||
"password=@password_placeholder@"
|
||||
else if (cfg.secretsFile != null) then
|
||||
"@secrets_placeholder@"
|
||||
else
|
||||
"@password_placeholder@"
|
||||
""
|
||||
}
|
||||
protocol=${cfg.protocol}
|
||||
${lib.optionalString (cfg.script != "") "script=${cfg.script}"}
|
||||
@@ -49,6 +53,10 @@ let
|
||||
''
|
||||
"${pkgs.replace-secret}/bin/replace-secret" "@password_placeholder@" "${cfg.passwordFile}" "/run/${RuntimeDirectory}/ddclient.conf"
|
||||
''
|
||||
else if (cfg.secretsFile != null) then
|
||||
''
|
||||
"${pkgs.replace-secret}/bin/replace-secret" "@secrets_placeholder@" "${cfg.secretsFile}" "/run/${RuntimeDirectory}/ddclient.conf"
|
||||
''
|
||||
else
|
||||
''
|
||||
sed -i '/^password=@password_placeholder@$/d' /run/${RuntimeDirectory}/ddclient.conf
|
||||
@@ -126,6 +134,16 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
secretsFile = lib.mkOption {
|
||||
default = null;
|
||||
type = nullOr str;
|
||||
description = ''
|
||||
A file containing the secrets for the dynamic DNS provider.
|
||||
This file should contain lines of valid secrets in the format specified by the ddclient documentation.
|
||||
If this option is set, it overrides the `passwordFile` option.
|
||||
'';
|
||||
};
|
||||
|
||||
interval = lib.mkOption {
|
||||
default = "10min";
|
||||
type = str;
|
||||
|
||||
Reference in New Issue
Block a user