# Cloudflare DNS Update Helper
A **very** basic Node-based CLI tool to easily manage **most** DNS records via Cloudflare's API.
**Note:** While this tool does support any record types supported by CloudFlare, it does not additional values such as priority, round-robin entries (multiple A records for the same hostname), and other advanced uses. This tool is designed for simply creating, updating, and deleting singular entry hostname records by type.
### Installation
```bash
git clone https://gitlab.velocity.org/blehmann/cf-dns-updater.git
cd cf-dns-updater
npm link
```
### Usage
You must make your Cloudflare API token available via an environment variable before issuing any CLI commands. The proper environment variable is `CLOUDFLARE_API_KEY`.
**Example:** `export CLOUDFLARE_API_KEY="fx#3y8k2qRP%qqVNH%5R@3J78"`
The script will exit `0` if successful otherwise it will exit `1` so that it can be called by other tools.
#### Add a New Record
```bash
cf-dns-updater -a add -h newdb.vselect.com -t CNAME -v writedb.vselect.com
```
#### Update a Record
```bash
cf-dns-updater -a update -h writedb.vselect.com -t A -v 4.30.174.28
```
**Note:** Updating a record will automatically request that the DNS servers at 1.1.1.1 purge the record for the given hostname.
#### Delete a Record
```bash
cf-dns-updater -a delete -h newdb.vselect.com -t CNAME
```