Merge pull request #102376 from felschr/feat/cfdyndns-password-file
nixos/cfdyndns: add apikeyFile option
This commit is contained in:
commit
e419de361d
@ -6,6 +6,12 @@ let
|
|||||||
cfg = config.services.cfdyndns;
|
cfg = config.services.cfdyndns;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
imports = [
|
||||||
|
(mkRemovedOptionModule
|
||||||
|
[ "services" "cfdyndns" "apikey" ]
|
||||||
|
"Use services.cfdyndns.apikeyFile instead.")
|
||||||
|
];
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
services.cfdyndns = {
|
services.cfdyndns = {
|
||||||
enable = mkEnableOption "Cloudflare Dynamic DNS Client";
|
enable = mkEnableOption "Cloudflare Dynamic DNS Client";
|
||||||
@ -17,10 +23,12 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
apikey = mkOption {
|
apikeyFile = mkOption {
|
||||||
type = types.str;
|
default = null;
|
||||||
|
type = types.nullOr types.str;
|
||||||
description = ''
|
description = ''
|
||||||
The API Key to use to authenticate to CloudFlare.
|
The path to a file containing the API Key
|
||||||
|
used to authenticate with CloudFlare.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -45,13 +53,17 @@ in
|
|||||||
Type = "simple";
|
Type = "simple";
|
||||||
User = config.ids.uids.cfdyndns;
|
User = config.ids.uids.cfdyndns;
|
||||||
Group = config.ids.gids.cfdyndns;
|
Group = config.ids.gids.cfdyndns;
|
||||||
ExecStart = "/bin/sh -c '${pkgs.cfdyndns}/bin/cfdyndns'";
|
|
||||||
};
|
};
|
||||||
environment = {
|
environment = {
|
||||||
CLOUDFLARE_EMAIL="${cfg.email}";
|
CLOUDFLARE_EMAIL="${cfg.email}";
|
||||||
CLOUDFLARE_APIKEY="${cfg.apikey}";
|
|
||||||
CLOUDFLARE_RECORDS="${concatStringsSep "," cfg.records}";
|
CLOUDFLARE_RECORDS="${concatStringsSep "," cfg.records}";
|
||||||
};
|
};
|
||||||
|
script = ''
|
||||||
|
${optionalString (cfg.apikeyFile != null) ''
|
||||||
|
export CLOUDFLARE_APIKEY="$(cat ${escapeShellArg cfg.apikeyFile})"
|
||||||
|
''}
|
||||||
|
${pkgs.cfdyndns}/bin/cfdyndns
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
users.users = {
|
users.users = {
|
||||||
|
Loading…
Reference in New Issue
Block a user