This repository has been archived on 2021-12-15. You can view files and clone it, but cannot push or open issues or pull requests.
2021-06-16 09:21:29 +00:00
|
|
|
#! /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 "MASTODON_ACCESS_TOKEN"
|
2021-06-16 13:26:04 +00:00
|
|
|
file_env "NEXTCLOUD_APP_PASSWORD"
|
2021-06-16 09:21:29 +00:00
|
|
|
|
|
|
|
echo "Passing it back to the upstream ENTRYPOINT/CMD..."
|
|
|
|
exec "$@"
|