22 lines
1013 B
Cheetah
22 lines
1013 B
Cheetah
#!/bin/sh
|
|
|
|
# Tymeslot reads no *_FILE variables: both start-docker.sh and config/runtime.exs take their configuration straight from the environment. So load the Docker secrets here, before handing over to the upstream start script.
|
|
#
|
|
# The file name maps directly to the variable name, uppercased:
|
|
# /run/secrets/secret_key_base -> SECRET_KEY_BASE
|
|
# /run/secrets/smtp_password -> SMTP_PASSWORD
|
|
#
|
|
# That means a new compose overlay needs no change here: declare the secret with the lowercased name of the variable it feeds and it is picked up.
|
|
if [ -d /run/secrets ]; then
|
|
for secret_file in /run/secrets/*; do
|
|
[ -f "$secret_file" ] || continue
|
|
var_name=$(basename "$secret_file" | tr '[:lower:]-' '[:upper:]_')
|
|
export "$var_name=$(cat "$secret_file")"
|
|
done
|
|
fi
|
|
|
|
echo "....Secrets have been loaded, now run $@...."
|
|
|
|
# start-docker.sh re-execs as the unprivileged 'app' user with `su -p`, which preserves the environment, so the exports above survive that transition.
|
|
exec "$@"
|