Browse Source

feat: Update DNS API URL to use extracted domain

pull/5287/head
Shubham Sharma 3 months ago
parent
commit
b6d002cb1c
  1. 9
      dnsapi/dns_mijn_host.sh

9
dnsapi/dns_mijn_host.sh

@ -42,8 +42,10 @@ dns_mijn_host_add() {
export _H1="API-Key: $MIJN_HOST_API_KEY" export _H1="API-Key: $MIJN_HOST_API_KEY"
export _H2="Content-Type: application/json" export _H2="Content-Type: application/json"
extracted_domain="${fulldomain#*_acme-challenge.}"
# Construct the API URL # Construct the API URL
api_url="$MIJN_HOST_API/domains/$_domain/dns"
api_url="$MIJN_HOST_API/domains/$extracted_domain/dns"
# Getting preivous records # Getting preivous records
get_response="$(_get "$api_url")" get_response="$(_get "$api_url")"
@ -58,7 +60,6 @@ dns_mijn_host_add() {
# Use the _post method to make the API request # Use the _post method to make the API request
response="$(_post "$data" "$api_url" "" "PUT")" response="$(_post "$data" "$api_url" "" "PUT")"
if _contains "$response" "error"; then if _contains "$response" "error"; then
_err "Error adding TXT record: $response" _err "Error adding TXT record: $response"
return 1 return 1
@ -91,9 +92,11 @@ dns_mijn_host_rm() {
# Build the payload for the API # Build the payload for the API
export _H1="API-Key: $MIJN_HOST_API_KEY" export _H1="API-Key: $MIJN_HOST_API_KEY"
export _H2="Content-Type: application/json" export _H2="Content-Type: application/json"
extracted_domain="${fulldomain#*_acme-challenge.}"
# Construct the API URL # Construct the API URL
api_url="$MIJN_HOST_API/domains/$_domain/dns"
api_url="$MIJN_HOST_API/domains/$extracted_domain/dns"
# Get current records # Get current records
response="$(_get "$api_url")" response="$(_get "$api_url")"

Loading…
Cancel
Save