Adopt new hierarchy pattern
This commit is contained in:
1
services/ddclient/volumes/init/.gitignore
vendored
Normal file
1
services/ddclient/volumes/init/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!entrypoint.sh
|
||||
29
services/ddclient/volumes/init/entrypoint.sh
Executable file
29
services/ddclient/volumes/init/entrypoint.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/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"
|
||||
}
|
||||
|
||||
apk add --update gettext
|
||||
|
||||
file_env 'GOTIFY_TOKEN'
|
||||
file_env 'CLOUDFLARE_TOKEN'
|
||||
|
||||
envsubst < /config/ddclient.conf.tpl > /ddclient.conf
|
||||
Reference in New Issue
Block a user