Add add-on duckDNS (#40)

Add add-on duckDNS
This commit is contained in:
Pascal Vizeli
2017-05-11 15:52:53 +02:00
committed by GitHub
parent b6858e862d
commit 4aede8cc51
3 changed files with 55 additions and 0 deletions

14
duckdns/Dockerfile Normal file
View File

@@ -0,0 +1,14 @@
FROM %%BASE_IMAGE%%
# Add version
ENV VERSION %%VERSION%%
ENV LANG C.UTF-8
# Setup base
RUN apk add --no-cache jq curl
# Copy data
COPY run.sh /
RUN chmod a+x /run.sh
CMD [ "/run.sh" ]

19
duckdns/config.json Normal file
View File

@@ -0,0 +1,19 @@
{
"name": "Duck DNS",
"version": "0.1",
"slug": "duckdns",
"description": "Free dynamic DNS hosted on Amazon VPC",
"url": "https://home-assistant.io/addons/duckdns/",
"startup": "before",
"boot": "auto",
"options": {
"token": null,
"domains": [null],
"seconds": 300
},
"schema": {
"token": "email",
"domain": ["str"],
"seconds": "int"
}
}

22
duckdns/run.sh Normal file
View File

@@ -0,0 +1,22 @@
#!/bin/bash
set -e
CONFIG_PATH=/data/options.json
TOKEN=$(jq --raw-output ".token" $CONFIG_PATH)
DOMAINS=$(jq --raw-output ".domains[]" $CONFIG_PATH)
SECONDS=$(jq --raw-output ".seconds" $CONFIG_PATH)
for line in $DOMAINS; do
if [ -z "$DOMAIN_ARG" ]; then
DOMAIN_ARG="$line"
else
DOMAIN_ARG="$DOMAIN_ARG,$line"
fi
done
#
while true; do
curl -k "https://www.duckdns.org/update?domains=$DOMAIN_ARG&token=$TOKEN&ip="
sleep "$SECONDS"
done