mirror of
https://github.com/aljazceru/addons.git
synced 2025-12-17 21:24:20 +01:00
14
duckdns/Dockerfile
Normal file
14
duckdns/Dockerfile
Normal 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
19
duckdns/config.json
Normal 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
22
duckdns/run.sh
Normal 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
|
||||||
Reference in New Issue
Block a user