Set up ddclient
This commit is contained in:
2
mounts/ddclient/data/.gitignore
vendored
Normal file
2
mounts/ddclient/data/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
!entrypoint.sh
|
||||
!postscript_gotify.sh
|
||||
0
mounts/ddclient/data/README.md
Normal file
0
mounts/ddclient/data/README.md
Normal file
33
mounts/ddclient/data/entrypoint.sh
Executable file
33
mounts/ddclient/data/entrypoint.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
# usage: file_env VAR [DEFAULT]
|
||||
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
|
||||
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
|
||||
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
|
||||
file_env() {
|
||||
local var="$1"
|
||||
local fileVar="${var}_FILE"
|
||||
local def="${2:-}"
|
||||
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
|
||||
mysql_error "Both $var and $fileVar are set (but are exclusive)"
|
||||
fi
|
||||
local val="$def"
|
||||
if [ "${!var:-}" ]; then
|
||||
val="${!var}"
|
||||
elif [ "${!fileVar:-}" ]; then
|
||||
val="$(< "${!fileVar}")"
|
||||
fi
|
||||
export "$var"="$val"
|
||||
unset "$fileVar"
|
||||
}
|
||||
|
||||
cd /app
|
||||
|
||||
|
||||
apk add --update gettext
|
||||
|
||||
file_env 'GOTIFY_TOKEN'
|
||||
file_env 'CLOUDFLARE_TOKEN'
|
||||
envsubst < /config/ddclient.conf.tpl > /config/ddclient.conf
|
||||
|
||||
/init "$@"
|
||||
7
mounts/ddclient/data/postscript_gotify.sh
Executable file
7
mounts/ddclient/data/postscript_gotify.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
curl "$GOTIFY_ADDRESS/message" \
|
||||
-X POST \
|
||||
-H "X-Gotify-Key: $GOTIFY_TOKEN" \
|
||||
-F "title=IP Address updated" \
|
||||
-F "message=IP address detected as $1" \
|
||||
-F "priority=5"
|
||||
Reference in New Issue
Block a user