Added config option to set ip for ipv4 and ipv6 (#627)

* Added config option to set ip for ipv4 and ipv6

* Made IPv4 and IPv6 optional

* Added // empty
This commit is contained in:
lclc98
2019-07-25 22:05:50 +10:00
committed by Pascal Vizeli
parent 3c9cf7a560
commit 9a399a6809
2 changed files with 6 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "Duck DNS", "name": "Duck DNS",
"version": "1.6", "version": "1.7",
"slug": "duckdns", "slug": "duckdns",
"description": "Free Dynamic DNS (DynDNS or DDNS) service with Let's Encrypt support", "description": "Free Dynamic DNS (DynDNS or DDNS) service with Let's Encrypt support",
"url": "https://www.home-assistant.io/addons/duckdns/", "url": "https://www.home-assistant.io/addons/duckdns/",
@@ -24,6 +24,8 @@
"certfile": "str", "certfile": "str",
"keyfile": "str" "keyfile": "str"
}, },
"ipv4": "str?",
"ipv6": "str?",
"token": "str", "token": "str",
"domains": ["str"], "domains": ["str"],
"seconds": "int" "seconds": "int"

View File

@@ -11,6 +11,8 @@ LE_DOMAINS=$(jq --raw-output '.domains[]' $CONFIG_PATH)
LE_UPDATE="0" LE_UPDATE="0"
# DuckDNS # DuckDNS
IPV4=$(jq --raw-output '.ipv4 // empty' $CONFIG_PATH)
IPV6=$(jq --raw-output '.ipv6 // empty' $CONFIG_PATH)
TOKEN=$(jq --raw-output '.token' $CONFIG_PATH) TOKEN=$(jq --raw-output '.token' $CONFIG_PATH)
DOMAINS=$(jq --raw-output '.domains | join(",")' $CONFIG_PATH) DOMAINS=$(jq --raw-output '.domains | join(",")' $CONFIG_PATH)
WAIT_TIME=$(jq --raw-output '.seconds' $CONFIG_PATH) WAIT_TIME=$(jq --raw-output '.seconds' $CONFIG_PATH)
@@ -45,7 +47,7 @@ fi
# Run duckdns # Run duckdns
while true; do while true; do
answer="$(curl -sk "https://www.duckdns.org/update?domains=$DOMAINS&token=$TOKEN&ip=&verbose=true")" || true answer="$(curl -sk "https://www.duckdns.org/update?domains=$DOMAINS&token=$TOKEN&ip=$IPV4&ipv6=$IPV6&verbose=true")" || true
echo "$(date): $answer" echo "$(date): $answer"
now="$(date +%s)" now="$(date +%s)"