diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index c362eac3a..f4d7c9fa4 100644 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -18,6 +18,19 @@ if [ "${PUID}" != "0" ] || [ "${PGID}" != "0" ]; then echo "Changing owner to $PUID:$PGID, done." fi +# support _FILE Suffix for environment variables +for file_var in $(env | cut -d '=' -f 1 | grep "_FILE$"); do + target_var=$(echo "$file_var" | cut -d'=' -f1 | sed 's/_FILE//') + file_path=$(printenv "$file_var") + + if [ -f "$file_path" ]; then + export "$target_var"=$(cat "$file_path" | tr -d '\n\r') + echo "Info: Loaded secret for $target_var from $file_path" + else + echo "Warning: Secret file $file_path not found for $target_var" + fi +done + if [ "${PUID}" != "0" ]; then exec su-exec $PUID:$PGID "$@" else diff --git a/scripts/run.sh b/scripts/run.sh index 4d90499d5..78659a04a 100644 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -19,11 +19,6 @@ export AUTH_SECRET=$(openssl rand -base64 32) # Cron job API key is generated every time the container starts as it is required for communication between nextjs-api and tasks-api export CRON_JOB_API_KEY=$(openssl rand -base64 32) -# Support secret file for encryption key (is not empty and file exists) -if [ -n "$SECRET_ENCRYPTION_KEY_FILE" ] && [ -f "$SECRET_ENCRYPTION_KEY_FILE" ]; then - export SECRET_ENCRYPTION_KEY=$(cat $SECRET_ENCRYPTION_KEY_FILE) -fi - # Start nginx proxy # 1. Replace the HOSTNAME in the nginx template file # 2. Create the nginx configuration file from the template