attempt to inject secrets into env

This commit is contained in:
2025-11-12 16:06:41 -05:00
parent 9a9114d880
commit c7dbc90fff

View File

@ -1,29 +1,6 @@
#!/bin/bash
set -eu
file_env() {
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
local val="$def"
if [ "${!var:-}" ]; then
val="${!var}"
elif [ "${!fileVar:-}" ]; then
val="$(<"${!fileVar}")"
fi
export "$var"="$val"
unset "$fileVar"
}
file_env "MYSQL_PASSWORD"
file_env "ADMIN_PASSWORD"
export DB_PASSWORD=$(cat /run/secrets/mysql_password)
export ADMIN_PASSWORD=$(cat /run/secrets/admin_password)
/usr/local/bin/akaunting.sh --start