Added compatibility for legacy configs

This commit is contained in:
Timothy Miller 2022-07-31 03:06:08 -04:00
parent 566ad3a7cf
commit 6933cbe27f

View File

@ -106,7 +106,12 @@ def commitRecord(ip):
return return
base_domain_name = response["result"]["name"] base_domain_name = response["result"]["name"]
for subdomain in subdomains: for subdomain in subdomains:
name = subdomain["name"].lower().strip() try:
name = subdomain["name"].lower().strip()
proxied = subdomain["proxied"]
except:
name = subdomain
proxied = config["proxied"]
fqdn = base_domain_name fqdn = base_domain_name
# Check if name provided is a reference to the root domain # Check if name provided is a reference to the root domain
if name != '' and name != '*' and name != '@': if name != '' and name != '*' and name != '@':
@ -115,7 +120,7 @@ def commitRecord(ip):
"type": ip["type"], "type": ip["type"],
"name": fqdn, "name": fqdn,
"content": ip["ip"], "content": ip["ip"],
"proxied": subdomain["proxied"], "proxied": proxied,
"ttl": ttl "ttl": ttl
} }
dns_records = cf_api( dns_records = cf_api(