Use existing FILE__ notation
This commit is contained in:
@@ -1,29 +1,3 @@
|
|||||||
#!/bin/bash
|
#!/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
|
apk add --update gettext
|
||||||
|
|
||||||
file_env 'GOTIFY_TOKEN'
|
|
||||||
file_env 'CLOUDFLARE_TOKEN'
|
|
||||||
|
|
||||||
envsubst < /config/ddclient.conf.tpl > /ddclient.conf
|
envsubst < /config/ddclient.conf.tpl > /ddclient.conf
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ services:
|
|||||||
image: linuxserver/ddclient
|
image: linuxserver/ddclient
|
||||||
environment:
|
environment:
|
||||||
GOTIFY_ADDRESS: http://gotify
|
GOTIFY_ADDRESS: http://gotify
|
||||||
GOTIFY_TOKEN_FILE: /run/secrets/gotify_token
|
FILE__GOTIFY_TOKEN: /run/secrets/gotify_token
|
||||||
CLOUDFLARE_DOMAIN: ${DDCLIENT_CLOUDFLARE_DOMAIN-test.dedicated.contact}
|
CLOUDFLARE_DOMAIN: ${DDCLIENT_CLOUDFLARE_DOMAIN-test.dedicated.contact}
|
||||||
CLOUDFLARE_TOKEN_FILE: /run/secrets/cloudflare_token
|
FILE__CLOUDFLARE_TOKEN: /run/secrets/cloudflare_token
|
||||||
networks:
|
networks:
|
||||||
- gotify
|
- gotify
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
Reference in New Issue
Block a user