Merge commit 'a23ec040f1ec1152cbb96e6b51e1e597b0c35a36'

This commit is contained in:
Alexa Amundson
2025-11-17 00:45:18 -06:00
4 changed files with 118 additions and 0 deletions

4
ops/scripts/apply_domains.py Normal file → Executable file
View File

@@ -3,6 +3,7 @@
apply_domains.py
Reads ops/domains.yaml and ensures that each domains DNS/forwarding
Reads ops/domains.yaml and ensures that each domain's DNS/forwarding
settings are correctly applied via GoDaddy and Cloudflare APIs.
This script is designed to be idempotent: re-running it will not create
duplicate records.
@@ -188,6 +189,7 @@ def update_cloudflare_dns_record(domain_entry):
if not zone_id:
return
# Determine the record name field expected by CF (full domain)
record_name = full_name
# List existing records to find match
@@ -202,6 +204,7 @@ def update_cloudflare_dns_record(domain_entry):
results = []
if results:
# update existing record if value differs
record_id = results[0]["id"]
current_value = results[0]["content"]
if current_value == record_value:
@@ -216,6 +219,7 @@ def update_cloudflare_dns_record(domain_entry):
except requests.HTTPError as e:
print(f"Error updating Cloudflare record for {full_name}: {e}")
else:
# create new record
payload = {"type": record_type, "name": record_name, "content": record_value, "ttl": 300, "proxied": False}
print(f"Creating Cloudflare record for {full_name}: {record_type} -> {record_value}")
try: