#!/bin/sh set -e set -u # DEBUG set -x # TODO there is a conflict between two shared vars # 1. from the original docker compose devicehub-teal # 2. from the new docker compose that integrates all dpp services wait_for_dpp_shared() { while true; do # specially ensure VERAMO_API_CRED_FILE is not empty, # it takes some time to get data in OPERATOR_TOKEN_FILE='operator-token.txt' if [ -f "/shared/${OPERATOR_TOKEN_FILE}" ] && \ [ -f "/shared/create_user_operator_finished" ]; then sleep 5 echo "Files ready to process." break else echo "Waiting for file in shared: ${OPERATOR_TOKEN_FILE}" sleep 5 fi done } # 3. Generate an environment .env file. # TODO cargar via shared gen_env_vars() { # specific dpp env vars if [ "${DPP_MODULE}" = 'y' ]; then # docker situation if [ -d "${DPP_SHARED:-}" ]; then wait_for_dpp_shared export API_DLT='http://api_connector:3010' export API_DLT_TOKEN="$(cat "/shared/${OPERATOR_TOKEN_FILE}")" export API_RESOLVER='http://id_index_api:3012' # TODO hardcoded export ID_FEDERATED='DH1' # .env situation else dpp_env_vars="$(cat < .env < "${DATASET_FILE}" <