2026-01-14 17:29:09 -03:00
|
|
|
#!/bin/sh
|
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
|
|
if [ -n "${VAULT_ENV_FILE:-}" ]; then
|
|
|
|
|
if [ -f "${VAULT_ENV_FILE}" ]; then
|
|
|
|
|
# shellcheck disable=SC1090
|
|
|
|
|
. "${VAULT_ENV_FILE}"
|
|
|
|
|
else
|
|
|
|
|
echo "Vault env file not found: ${VAULT_ENV_FILE}" >&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
2026-01-14 20:46:46 -03:00
|
|
|
if [ -n "${VAULT_COPY_FILES:-}" ]; then
|
|
|
|
|
old_ifs="$IFS"
|
|
|
|
|
IFS=','
|
2026-01-14 21:24:16 -03:00
|
|
|
for pair in ${VAULT_COPY_FILES}; do
|
2026-01-14 20:46:46 -03:00
|
|
|
src="${pair%%:*}"
|
|
|
|
|
dest="${pair#*:}"
|
|
|
|
|
if [ -z "${src}" ] || [ -z "${dest}" ]; then
|
|
|
|
|
echo "Vault copy entry malformed: ${pair}" >&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
if [ ! -f "${src}" ]; then
|
|
|
|
|
echo "Vault file not found: ${src}" >&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
mkdir -p "$(dirname "${dest}")"
|
|
|
|
|
cp "${src}" "${dest}"
|
|
|
|
|
done
|
2026-01-14 21:24:16 -03:00
|
|
|
IFS="$old_ifs"
|
2026-01-14 20:46:46 -03:00
|
|
|
fi
|
|
|
|
|
|
2026-01-14 17:29:09 -03:00
|
|
|
exec "$@"
|