From b4c83b31f26ccd333b95bf4fa348f55b60e76aa3 Mon Sep 17 00:00:00 2001 From: Dennis Gaida <2392217+DennisGaida@users.noreply.github.com> Date: Thu, 9 Oct 2025 16:25:36 +0200 Subject: Support docker secrets via startup script Add docker secrets support --- .docker/app/startup.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.docker/app/startup.sh b/.docker/app/startup.sh index 64111dd19..3daeb9477 100644 --- a/.docker/app/startup.sh +++ b/.docker/app/startup.sh @@ -13,6 +13,23 @@ done unset HTTP_PORT unset HTTP_HOST +# allow setting environment variables with docker secrets +# the format is _FILE +suffix="_FILE" + +# Loop through all environment variables +for var in $(printenv | awk -F= '{print $1}'); do + if [[ $var == *"$suffix" ]]; then + envFileName=`printenv ${var}` + if [[ -f "$envFileName" ]]; then + envVar="${var%$suffix}" # generate the original env var without suffix + val=`cat $envFileName` # get the value of the secret from file + export "${envVar}"="$val" # set the original env var + echo "${envVar} environment variable was set by secret ${envFileName}" + fi + fi +done + if ! id app >/dev/null 2>&1; then addgroup -g $OWNER_GID app adduser -D -h $APP_INSTALL_BASE_DIR -G app -u $OWNER_UID app -- cgit v1.2.3-54-g00ecf