Entrypoint for the auto-conf
This commit is contained in:
28
mounts/gotify/config/entrypoint.sh
Executable file
28
mounts/gotify/config/entrypoint.sh
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
#/bin/sh
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
file_env 'GOTIFY_DEFAULTUSER_PASS'
|
||||||
|
|
||||||
|
./gotify-app "$@"
|
||||||
@@ -3,13 +3,15 @@ name: Notifications
|
|||||||
services:
|
services:
|
||||||
gotify:
|
gotify:
|
||||||
image: gotify/server
|
image: gotify/server
|
||||||
# Hack to get around the lack of secret support in Gotify
|
entrypoint: ./entrypoint.sh
|
||||||
entrypoint: ['/bin/sh', '-c', 'GOTIFY_DEFAULTUSER_PASS=$(cat /run/secrets/admin_password) ./gotify-app']
|
|
||||||
networks:
|
networks:
|
||||||
- gotify
|
- gotify
|
||||||
- traefik
|
- traefik
|
||||||
volumes:
|
volumes:
|
||||||
- gotify:/app/data
|
- gotify:/app/data
|
||||||
|
configs:
|
||||||
|
- source: gotify_entrypoint
|
||||||
|
target: /app/entrypoint.sh
|
||||||
secrets:
|
secrets:
|
||||||
- admin_password
|
- admin_password
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
@@ -30,6 +32,10 @@ volumes:
|
|||||||
o: bind
|
o: bind
|
||||||
device: ${MOUNT_DIR?}/gotify/data/
|
device: ${MOUNT_DIR?}/gotify/data/
|
||||||
|
|
||||||
|
configs:
|
||||||
|
gotify_entrypoint:
|
||||||
|
file: ${MOUNT_DIR?}/gotify/config/entrypoint.sh
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
admin_password:
|
admin_password:
|
||||||
file: ${MOUNT_DIR?}/gotify/secrets/admin_password
|
file: ${MOUNT_DIR?}/gotify/secrets/admin_password
|
||||||
|
|||||||
Reference in New Issue
Block a user