From b6d002cb1c643e29bb50d242aadfb4261a8ab8c4 Mon Sep 17 00:00:00 2001 From: Shubham Sharma Date: Sun, 22 Sep 2024 16:42:28 +0530 Subject: [PATCH] feat: Update DNS API URL to use extracted domain --- dnsapi/dns_mijn_host.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dnsapi/dns_mijn_host.sh b/dnsapi/dns_mijn_host.sh index a93028d6..e0e2f89c 100644 --- a/dnsapi/dns_mijn_host.sh +++ b/dnsapi/dns_mijn_host.sh @@ -42,8 +42,10 @@ dns_mijn_host_add() { export _H1="API-Key: $MIJN_HOST_API_KEY" export _H2="Content-Type: application/json" + extracted_domain="${fulldomain#*_acme-challenge.}" + # Construct the API URL - api_url="$MIJN_HOST_API/domains/$_domain/dns" + api_url="$MIJN_HOST_API/domains/$extracted_domain/dns" # Getting preivous records get_response="$(_get "$api_url")" @@ -58,7 +60,6 @@ dns_mijn_host_add() { # Use the _post method to make the API request response="$(_post "$data" "$api_url" "" "PUT")" - if _contains "$response" "error"; then _err "Error adding TXT record: $response" return 1 @@ -91,9 +92,11 @@ dns_mijn_host_rm() { # Build the payload for the API export _H1="API-Key: $MIJN_HOST_API_KEY" export _H2="Content-Type: application/json" + + extracted_domain="${fulldomain#*_acme-challenge.}" # Construct the API URL - api_url="$MIJN_HOST_API/domains/$_domain/dns" + api_url="$MIJN_HOST_API/domains/$extracted_domain/dns" # Get current records response="$(_get "$api_url")"