diff options
author | Aaron Andersen <aaron@fosslib.net> | 2020-11-10 18:08:25 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-10 18:08:25 -0500 |
commit | e419de361d70b37434d459bc6a7195103c1903e6 (patch) | |
tree | 6397bc044b983b7dcd27373cae47cea908c35cc6 | |
parent | dd72edcdae1ef5fb68e19e8d8220983d180a3d47 (diff) | |
parent | a33290b1a85b428cb33f3c5cdaee6fff7c7e2458 (diff) | |
download | nixpkgs-e419de361d70b37434d459bc6a7195103c1903e6.tar nixpkgs-e419de361d70b37434d459bc6a7195103c1903e6.tar.gz nixpkgs-e419de361d70b37434d459bc6a7195103c1903e6.tar.bz2 nixpkgs-e419de361d70b37434d459bc6a7195103c1903e6.tar.lz nixpkgs-e419de361d70b37434d459bc6a7195103c1903e6.tar.xz nixpkgs-e419de361d70b37434d459bc6a7195103c1903e6.tar.zst nixpkgs-e419de361d70b37434d459bc6a7195103c1903e6.zip |
Merge pull request #102376 from felschr/feat/cfdyndns-password-file
nixos/cfdyndns: add apikeyFile option
-rw-r--r-- | nixos/modules/services/misc/cfdyndns.nix | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/nixos/modules/services/misc/cfdyndns.nix b/nixos/modules/services/misc/cfdyndns.nix index dcf41602273..15af1f50da1 100644 --- a/nixos/modules/services/misc/cfdyndns.nix +++ b/nixos/modules/services/misc/cfdyndns.nix @@ -6,6 +6,12 @@ let cfg = config.services.cfdyndns; in { + imports = [ + (mkRemovedOptionModule + [ "services" "cfdyndns" "apikey" ] + "Use services.cfdyndns.apikeyFile instead.") + ]; + options = { services.cfdyndns = { enable = mkEnableOption "Cloudflare Dynamic DNS Client"; @@ -17,10 +23,12 @@ in ''; }; - apikey = mkOption { - type = types.str; + apikeyFile = mkOption { + default = null; + type = types.nullOr types.str; 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"; User = config.ids.uids.cfdyndns; Group = config.ids.gids.cfdyndns; - ExecStart = "/bin/sh -c '${pkgs.cfdyndns}/bin/cfdyndns'"; }; environment = { CLOUDFLARE_EMAIL="${cfg.email}"; - CLOUDFLARE_APIKEY="${cfg.apikey}"; CLOUDFLARE_RECORDS="${concatStringsSep "," cfg.records}"; }; + script = '' + ${optionalString (cfg.apikeyFile != null) '' + export CLOUDFLARE_APIKEY="$(cat ${escapeShellArg cfg.apikeyFile})" + ''} + ${pkgs.cfdyndns}/bin/cfdyndns + ''; }; users.users = { |