npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cloudflare-dynamic-dns2

v3.0.1

Published

Updates a Cloudflare DNS address record with an IP address

Downloads

7

Readme

cloudflare-dynamic-dns2

Overview

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.

Command-line program

Installation of command-line program

npm install -g cloudflare-dynamic-dns2

Usage via cli

Create a /etc/cloudflare/config.json for example like this:

{
  "email": "[email protected]",
  "key": "17b8137B813b585c",
  "domain": "hugojosefson.com",
  "subdomains": [
    "www",
    "@"
  ]
}

The properties are described for the API below.

Run the built-in command-line tool:

update-cloudflare-dns

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.

API

Installation for API use

npm install --save cloudflare-dynamic-dns2

Usage via API

The cloudflare-dynamic-dns2 module is a function which takes one argument, an options object, with the following properties:

  • email - the email associated with your Cloudflare account (string, mandatory)
  • 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.

Example

The following example illustrates the basic usage of cloudflare-dynamic-dns2, updating the A record for boo.example.com:

const cloudflareddns = require('cloudflare-dynamic-dns2');

// Use external IP address of current machine
cloudflareddns({
    email: '[email protected]',
    key: 'abcde12235',
    domain: 'example.com',
    subdomain: 'boo'
}).then(
    ip => console.log(`Updated boo.example.com to ${ip}`),
    reason => console.error(reason)
);

License

cloudflare-dynamic-dns2 is licensed under the MIT license. Please see the LICENSE.md file for more information.