cloudflare-dynamic-dns2 is a Node.js module that updates a Cloudflare DNS address record with an
IP address. See CHANGES.md for difference from original, and reason for this fork.
Installation of command-line program
npm install -g cloudflare-dynamic-dns2
Usage via cli
/etc/cloudflare/config.json for example like this:
The properties are described for the API below.
Run the built-in command-line tool:
If the program exits with exit code
0 and prints nothing, all went well. Otherwise it will print
whatever error occurred and exit with a non-zero exit code.
Installation for API use
npm install --save cloudflare-dynamic-dns2
Usage via API
cloudflare-dynamic-dns2 module is a function which takes one argument, an options object, with
the following properties:
key- the API key associated with your Cloudflare account (string, mandatory)
domain- the domain corresponding to the DNS address record you wish to change (string, mandatory)
subdomain- the subdomain corresponding to the DNS address record you wish to change;
"@"to update the apex record (string, mandatory)
ip- the new IP address for the address record; if no IP address is specified, the external IP address of the current machine is used (string, optional)
The function returns a
Promise which resolves to the actual IP address if the request was
successful, or rejects with an
Error if it was not.
The following example illustrates the basic usage of
cloudflare-dynamic-dns2, updating the A
const cloudflareddns = ;// Use external IP address of current machine;
cloudflare-dynamic-dns2 is licensed under the MIT license. Please see the
LICENSE.md file for more information.