Add entrypoint to gotify/data

This commit is contained in:
Colin Hebert
2022-12-26 15:29:01 +01:00
parent c02b458455
commit 13a146a985
4 changed files with 31 additions and 8 deletions

1
mounts/.gitignore vendored
View File

@@ -2,3 +2,4 @@
!*/data/README.md
*/secrets/*
!*/secrets/README.md
!.gitignore

1
mounts/gotify/data/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
!entrypoint.sh

View File

@@ -0,0 +1,28 @@
#!/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
file_env 'GOTIFY_DEFAULTUSER_PASS'
./gotify-app "$@"

View File

@@ -3,15 +3,12 @@ name: Notifications
services:
gotify:
image: gotify/server
entrypoint: ./entrypoint.sh
entrypoint: ./data/entrypoint.sh
networks:
- gotify
- traefik
volumes:
- gotify:/app/data
configs:
- source: gotify_entrypoint
target: /app/entrypoint.sh
secrets:
- admin_password
restart: unless-stopped
@@ -32,10 +29,6 @@ volumes:
o: bind
device: ${MOUNT_DIR?}/gotify/data/
configs:
gotify_entrypoint:
file: ${MOUNT_DIR?}/gotify/config/entrypoint.sh
secrets:
admin_password:
file: ${MOUNT_DIR?}/gotify/secrets/admin_password