#!/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() { INIT_ORG="${INIT_ORG:-example-org}" INIT_USER="${INIT_USER:-user@example.org}" INIT_PASSWD="${INIT_PASSWD:-1234}" ADMIN='True' PREDEFINED_TOKEN="${PREDEFINED_TOKEN:-}" # specific dpp env vars if [ "${DPP:-}" = 'true' ]; then # fill env vars in this docker entrypoint 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' # propagate to .env dpp_env_vars="$(cat < .env < "${DATASET_FILE}" <