fix
This commit is contained in:
parent
2192f146ea
commit
369be75066
|
|
@ -81,8 +81,23 @@ ensure_record() {
|
||||||
local search_res=$(curl -s -X GET "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records?type=$type&name=$name" \
|
local search_res=$(curl -s -X GET "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records?type=$type&name=$name" \
|
||||||
-H "Authorization: Bearer $CF_API_TOKEN" -H "Content-Type: application/json")
|
-H "Authorization: Bearer $CF_API_TOKEN" -H "Content-Type: application/json")
|
||||||
|
|
||||||
local rec_id=$(echo "$search_res" | jq -r '.result[0].id')
|
local rec_id
|
||||||
local rec_content=$(echo "$search_res" | jq -r '.result[0].content')
|
local rec_content
|
||||||
|
|
||||||
|
if [ "$type" == "TXT" ] && [ "$name" == "$DOMAIN_NAME" ] && [[ "$content" == v=spf1* ]]; then
|
||||||
|
# Spezialfall Root-Domain SPF: Filtere gezielt den SPF-Eintrag heraus,
|
||||||
|
# damit z.B. Google Site Verification nicht überschrieben wird.
|
||||||
|
rec_id=$(echo "$search_res" | jq -r '.result[] | select(.content | contains("v=spf1")) | .id' | head -n 1)
|
||||||
|
rec_content=$(echo "$search_res" | jq -r '.result[] | select(.content | contains("v=spf1")) | .content' | head -n 1)
|
||||||
|
else
|
||||||
|
# Standardverhalten für alle anderen (A, CNAME, MX, etc.)
|
||||||
|
rec_id=$(echo "$search_res" | jq -r '.result[0].id')
|
||||||
|
rec_content=$(echo "$search_res" | jq -r '.result[0].content')
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Fallback für jq, damit das restliche Skript funktioniert
|
||||||
|
[ -z "$rec_id" ] && rec_id="null"
|
||||||
|
[ -z "$rec_content" ] && rec_content="null"
|
||||||
|
|
||||||
if [ "$type" == "MX" ]; then
|
if [ "$type" == "MX" ]; then
|
||||||
json_data=$(jq -n --arg t "$type" --arg n "$name" --arg c "$content" --argjson p "$proxied" --argjson prio "$priority" \
|
json_data=$(jq -n --arg t "$type" --arg n "$name" --arg c "$content" --argjson p "$proxied" --argjson prio "$priority" \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue