You may also have a look at the official CLI version of Cloudflare-DDNS-Sync:
Cloudflare-DDNS-Sync is a simple NPM package that updates the IP address of Cloudflare DNS records.
The goal of Cloudflare-DDNS-Sync is to make updating the IP of Cloudflare DNS records as easy as possible.
- Node
- Cloudflare Account
To install Cloudflare-DDNS-Sync simply run:
npm install cloudflare-ddns-sync
in your project folder.
var CloudflareDDNSSync = require("cloudflare-ddns-sync");
var ddnsSync = new CloudflareDDNSSync({
"auth" : {
"email" : "[email protected]",
"key" : "your_cloudflare_api_key"
},
"domain": "your-domain.com",
"records" : [
"subdomain.your-domain.com",
"subdomain2.your-domain.com"
],
});
ddnsSync.sync()
.then((results) => {
for(var result of results){
console.log(result);
}
});
Hint: If a record is not existing, CDS will automatically create it when syncing.
- getIp()
- getRecordIps()
- sync(<ip>)
- syncOnIpChange(<callback>)
- syncByInterval(interval, <ip>, <callback>)
- syncOnceEveryHour(minute, <ip>, <callback>)
- syncOnceEveryDay([hour, <minute>], <ip>, <callback>)
- syncOnceEveryWeek([dayOfWeek, <hour>, <minute>], <ip>, <callback>)
- syncOnceEveryMonth([dayOfMonth, <hour>, <minute>], <ip>, <callback>)
- syncByCronTime(cronTime, <ip>, <callback>)
- syncAtDate(date, <ip>, <callback>)
- syncByTimestring(timestring, <ip>, <callback>)
- stopSyncOnIpChange()
For a more detailed view, have a look at the Documentation
- Go to Cloudflare
- Log In
- In the upper right corner: click on your email address
- Go to "My Profile"
- In the "API Key"-Section: click on the "View API Key"-Button of the Global Key
- Enter your password and fill the captcha
- Copy the API Key
- ๐ Update README
- ๐ Fix Stopping Sync On IP Change
- ๐ Fix Crontime Converter For Hour
- ๐ Fix Syncing With Crontime Without Setting an IP
- โก๏ธ Small Performance Improvements
- ๐ Improve Code Quality
- ๐ Extract Business Rules
- ๐ Fix Wrong Using of Const
- ๐ Fix Bug When 'public-ip' Throws An Error
- ๐ Improve Code Quality
- โจ Add Create Not Existing Records Functionality
- โจ Add Fallback getIp Function
- โจ Add Stop SyncOnIpChange Function
- ๐ Fix ipChange Interval
- ๐ Add Changelog
- โจ Add getRecordIps Function
- โป๏ธ Refactor syncOnIpChange
- โ Add Tests for Sync Functionality
- ๐ Improve README
- ๐ Add NPM Badge
- ๐ฅ Remove Unnecessary Code
- ๐ธ Update Description
- ๐จ Order Dependencies
- ๐จ Lint files
- ๐ Fix README
- โจ Add syncAtDate Function
- ๐ Improve README
- ๐ Fix README
- โจ Add onIpChange Function
- ๐ Adjust README
- ๐ Move Utils to Lib
- ๐ Move IP Functions to Lib
- ๐ Move Dependencies to devDependencies
- ๐ง Update Eslint Config
- ๐จ Fix Eslit Error
- โก๏ธ Improve Performance of First Sync
- โจ Add Schedule Functionality
- ๐ธ Improve Success Message of Sync Function
- ๐ Fix Typos in README
- ๐ Add Schedule Functions to README
- โ Add Unittests
- โจ Add Eslint
- ๐ Fix Typo in README
- ๐ Add LICENSE
- ๐ Add "Get Your Cloudflare Api Key"-Section to README
- โจ Add sync Function -> changes the IP of the configured DNS records on Cloudflare
- โจ Add getIp Function -> returns the external IP
- ๐ Add README