libdns / hetzner

Hetzner DNS implementation for libdns
MIT License
5 stars 8 forks source link

Use default zone TTL #3

Open lus opened 2 years ago

lus commented 2 years ago

The Hetzner DNS API returns a default TTL field for every zone. Based on this, records that use a non-custom TTL will not include the ttl field at all in their JSON representation and thus result in a libdns.Record object with a TTL of 0 seconds.

This PR solves this by enhancing the existent getZoneID (renamed to getZoneData) to not only return the zone's ID but also its default TTL. It also updates the unmarshalling step of a JSON record returned by the Hetzner API to use this default TTL when the ttl field does not exist.

mholt commented 2 years ago

@matthiasng Could you take a look at this please? 😃