Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit a47bfcb

Browse files
committed
Keep proxied state during IP-address update
Previously the program didn't store the state of the Cloudflare proxy setting, always setting it to proxied=False during an update. With this commit the script will store the state of the 'proxied' value and restore it during a record update.
1 parent 286cb0f commit a47bfcb

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

examples/example_update_dynamic_dns.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,16 @@ def do_dns_update(cf, zone_name, zone_id, dns_name, ip_address, ip_address_type)
6565
updated = True
6666
continue
6767

68+
proxied_state = dns_record['proxied']
69+
6870
# Yes, we need to update this record - we know it's the same address type
6971

7072
dns_record_id = dns_record['id']
7173
dns_record = {
7274
'name':dns_name,
7375
'type':ip_address_type,
74-
'content':ip_address
76+
'content':ip_address,
77+
'proxied':proxied_state
7578
}
7679
try:
7780
dns_record = cf.zones.dns_records.put(zone_id, dns_record_id, data=dns_record)

0 commit comments

Comments
 (0)