]> git.proxmox.com Git - mirror_acme.sh.git/blobdiff - dnsapi/dns_dynv6.sh
fix format
[mirror_acme.sh.git] / dnsapi / dns_dynv6.sh
index dbb36255c81a7aae2fb5b81fd0f3549c9df0b386..9efc9aeb0b4ebef787f18e88eff861fc86b4e89b 100644 (file)
@@ -1,38 +1,23 @@
 #!/usr/bin/env sh
 #Author StefanAbl
 #Usage specify a private keyfile to use with dynv6 'export KEY="path/to/keyfile"'
+#or use the HTTP REST API by by specifying a token 'export DYNV6_TOKEN="value"
 #if no keyfile is specified, you will be asked if you want to create one in /home/$USER/.ssh/dynv6 and /home/$USER/.ssh/dynv6.pub
+
+dynv6_api="https://dynv6.com/api/v2"
 ########  Public functions #####################
 # Please Read this guide first: https://github.com/Neilpang/acme.sh/wiki/DNS-API-Dev-Guide
-#Usage: dns_myapi_add  _acme-challenge.www.domain.com  "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
+#Usage: dns_dynv6_add  _acme-challenge.www.domain.com  "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
 dns_dynv6_add() {
   fulldomain=$1
   txtvalue=$2
   _info "Using dynv6 api"
   _debug fulldomain "$fulldomain"
   _debug txtvalue "$txtvalue"
-<<<<<<< HEAD
-
   _get_authentication
   if [ "$dynv6_token" ]; then
     _dns_dynv6_add_http
     return $?
-=======
-  _get_keyfile
-  _info "using keyfile $dynv6_keyfile"
-  _your_hosts="$(ssh -i "$dynv6_keyfile" api@dynv6.com hosts)"
-  if ! _get_domain "$fulldomain" "$_your_hosts"; then
-    _err "Host not found on your account"
-    return 1
-  fi
-  _debug "found host on your account"
-  returnval="$(ssh -i "$dynv6_keyfile" api@dynv6.com hosts \""$_host"\" records set \""$_record"\" txt data \""$txtvalue"\")"
-  _debug "Dynv6 returend this after record was added: $returnval"
-  if _contains "$returnval" "created"; then
-    return 0
-  elif _contains "$returnval" "updated"; then
-    return 0
->>>>>>> first attempt to make travis happy
   else
     _info "using key file $dynv6_keyfile"
     _your_hosts="$(ssh -i "$dynv6_keyfile" api@dynv6.com hosts)"
@@ -63,7 +48,6 @@ dns_dynv6_rm() {
   _info "Using dynv6 API"
   _debug fulldomain "$fulldomain"
   _debug txtvalue "$txtvalue"
-<<<<<<< HEAD
   _get_authentication
   if [ "$dynv6_token" ]; then
     _dns_dynv6_rm_http
@@ -79,23 +63,11 @@ dns_dynv6_rm() {
     _info "$(ssh -i "$dynv6_keyfile" api@dynv6.com hosts "\"$_host\"" records del "\"$_record\"" txt)"
     return 0
   fi
-=======
-  _get_keyfile
-  _info "using keyfile $dynv6_keyfile"
-  _your_hosts="$(ssh -i "$dynv6_keyfile" api@dynv6.com hosts)"
-  if ! _get_domain "$fulldomain" "$_your_hosts"; then
-    _err "Host not found on your account"
-    return 1
-  fi
-  _debug "found host on your account"
-  _info "$(ssh -i "$dynv6_keyfile" api@dynv6.com hosts "\"$_host\"" records del "\"$_record\"" txt)"
-  return 0
->>>>>>> first attempt to make travis happy
 }
 #################### Private functions below ##################################
 #Usage: No Input required
 #returns
-#dynv6_keyfile the path to the new keyfile that has been generated
+#dynv6_keyfile the path to the new key file that has been generated
 _generate_new_key() {
   dynv6_keyfile="$(eval echo ~"$USER")/.ssh/dynv6"
   _info "Path to key file used: $dynv6_keyfile"
@@ -303,4 +275,11 @@ _dynv6_rest() {
   else
     response="$(_get "$dynv6_api/$ep")"
   fi
+
+  if [ "$?" != "0" ]; then
+    _err "error $ep"
+    return 1
+  fi
+  _debug2 response "$response"
+  return 0
 }