# cloudflare-dynamic-dns2

> Updates a Cloudflare DNS address record with an IP address

Latest version **3.0.1** (published 2016-11-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install cloudflare-dynamic-dns2
pnpm add cloudflare-dynamic-dns2
yarn add cloudflare-dynamic-dns2
bun add cloudflare-dynamic-dns2
```

Provides the command `update-cloudflare-dns`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2016-11-09 |
| First published | 2016-03-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Michael Kourlas |
| Maintainers | hugojosefson |
| Keywords | cloudflare, dns, dyndns |

## Links

- npm: https://www.npmjs.com/package/cloudflare-dynamic-dns2
- Repository: https://github.com/hugojosefson/cloudflare-dynamic-dns2
- Homepage: https://github.com/hugojosefson/cloudflare-dynamic-dns2#readme
- Issues: https://github.com/hugojosefson/cloudflare-dynamic-dns2/issues
- npm.io page: https://npm.io/package/cloudflare-dynamic-dns2

## Dependencies (4)

- [lodash](https://npm.io/package/lodash.md) ^4.2.1
- [cloudflare](https://npm.io/package/cloudflare.md) ^1.0.5
- [request-promise](https://npm.io/package/request-promise.md) ^2.0.0
- [object-path-immutable](https://npm.io/package/object-path-immutable.md) ^0.5.0

## Recent versions

- 3.0.1 (latest) — 2016-11-09
- 3.0.0 — 2016-11-07
- 2.0.2 — 2016-03-25
- 2.0.1 — 2016-03-25

## 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](CHANGES.md) for difference from original, and reason for this fork.

## Command-line program ##

### Installation of command-line program ###

```bash
npm install -g cloudflare-dynamic-dns2
```

### Usage via cli ###

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

```json
{
  "email": "hugo@josefson.org",
  "key": "17b8137B813b585c",
  "domain": "hugojosefson.com",
  "subdomains": [
    "www",
    "@"
  ]
}
```

The properties are described for the API below.

Run the built-in command-line tool:

```bash
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 ##

```bash
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`:

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

// Use external IP address of current machine
cloudflareddns({
    email: 'jsmith@example.com',
    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](http://opensource.org/licenses/MIT). Please see the
`LICENSE.md` file for more information.

---
_Source: https://npm.io/package/cloudflare-dynamic-dns2 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
