services(cloudflare-dyndns): use new CLOUDFLARE_API_TOKEN_FILE setting
We recently upgraded to cloudflare-dyndns 5.3: https://github.com/NixOS/nixpkgs/commit/24f9910708d0d38c0e0cd9cc863bde4149b48fb6, so we can now use this new `CLOUDFLARE_API_TOKEN_FILE` feature that landed in v5.2: https://github.com/kissgyorgy/cloudflare-dyndns/commit/1d563d27529e5c5373d1b747536ea09fa8366d88
This commit is contained in:
@@ -108,13 +108,14 @@ in
|
||||
++ lib.optional cfg.proxied "--proxied";
|
||||
in
|
||||
''
|
||||
export CLOUDFLARE_API_TOKEN=$(< "''${CREDENTIALS_DIRECTORY}/apiToken")
|
||||
export CLOUDFLARE_API_TOKEN_FILE=''${CREDENTIALS_DIRECTORY}/apiToken
|
||||
|
||||
# Added 2025-03-10: `cfg.apiTokenFile` used to be passed as an
|
||||
# `EnvironmentFile` to the service, which required it to be of
|
||||
# the form "CLOUDFLARE_API_TOKEN=" rather than just the secret.
|
||||
# If we detect this legacy usage, error out.
|
||||
if [[ $CLOUDFLARE_API_TOKEN == CLOUDFLARE_API_TOKEN* ]]; then
|
||||
token=$(< "''${CLOUDFLARE_API_TOKEN_FILE}")
|
||||
if [[ $token == CLOUDFLARE_API_TOKEN* ]]; then
|
||||
echo "Error: your api token starts with 'CLOUDFLARE_API_TOKEN='. Remove that, and instead specify just the token." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user