anaganisk / digitalocean-dynamic-dns-ip

A simple script to automatically update Digital ocean DNS records with dynamic IP
Other
104 stars 22 forks source link

0 of x records updated #15

Closed tonydm closed 3 years ago

tonydm commented 3 years ago

Hello,

I have spun up a Docker container to test your service utility, it's exactly what I was looking for. When I run the command, it successfully reads the config file, but reports "0 of 1 records updated". The API key I'm using has Read/Write Scope. I'm not sure if I'm overlooking something in the config.

Thank you

TD

root@160b0ec7a0ed:/tmp/digitalocean-dynamic-dns-ip# go version
go version go1.13.13 linux/amd64
root@160b0ec7a0ed:/tmp/digitalocean-dynamic-dns-ip# ./digitalocean-dynamic-dns-ip
2021/09/06 22:26:17 Discovered IPv4 address `24.116.xx.xx`
2021/09/06 22:26:17 mydomain.com: START
2021/09/06 22:26:17 mydomain.com: 1 to update
2021/09/06 22:26:17 https://api.digitalocean.com/v2/domains/mydomain.com/records
2021/09/06 22:26:17 https://api.digitalocean.com/v2/domains/mydomain.com/records?page=2&per_page=20
2021/09/06 22:26:18 https://api.digitalocean.com/v2/domains/mydomain.com/records?page=3&per_page=20
2021/09/06 22:26:18 mydomain.com: 45 DNS records found in DigitalOcean
2021/09/06 22:26:18 mydomain.com: trying to update `A` : `subdomainOrRecord`
2021/09/06 22:26:18 mydomain.com: 0 of 1 records updated
2021/09/06 22:26:18 mydomain.com: END
root@160b0ec7a0ed:/tmp/digitalocean-dynamic-dns-ip# 
{
  "apikey": "<key_obfuscated>",
  "doPageSize": 20,
  "useIPv4": true,
  "useIPv6": false,
  "allowIPv4InIPv6": false,
  "ipv4CheckUrl": "https://ipv4bot.whatismyipaddress.com",
  "domains": [
    {
      "domain": "mydomain.com",
      "records": [
        {
          "name": "subdomainOrRecord",
          "type": "A"
        }
      ]
    }
  ]
}
tonydm commented 3 years ago

Nevermind, I found that it's my misunderstanding of the config options. After using some other scripts I found where the domain records are listed, I discovered that the "Name" is the subdomain of the domain. Once I discovered that the utility worked as expected. Thanks again

So for someone else using your script and finds themself confused by what the config options represent, the config would look like this:

{
  "apikey": "<key_obfuscated>",
  "doPageSize": 20,
  "useIPv4": true,
  "useIPv6": false,
  "allowIPv4InIPv6": false,
  "ipv4CheckUrl": "https://ipv4bot.whatismyipaddress.com",
  "domains": [
    {
      "domain": "mydomain.com",
      "records": [
        {
          "name": "subdomain1",
          "type": "A"
        },
        {
          "name": "subdomain2",
          "type": "A"
        },
      ]
    }
  ]
}