Skip to content

Commit

Permalink
Merge pull request #69 from HorizenOfficial/fix_entrypoint_remotesigning
Browse files Browse the repository at this point in the history
Fix entrypoint
  • Loading branch information
paolocappelletti authored Oct 11, 2023
2 parents dce6f8f + c2a59e0 commit bcf5661
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions dockerfiles/evmapp/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,34 +115,41 @@ if [ "${SCNODE_CERT_SIGNING_ENABLED:-}" = "true" ]; then
exit 1
fi

if [ "${SCNODE_REMOTE_KEY_MANAGER_ENABLED:-}" = "true" ] && [ -z "${SCNODE_REMOTE_KEY_MANAGER_ADDRESS:-}" ]; then
echo "Error: When SCNODE_CERT_SIGNING_ENABLED=true and SCNODE_REMOTE_KEY_MANAGER_ENABLED=true SCNODE_REMOTE_KEY_MANAGER_ADDRESS needs to be set."
sleep 5
exit 1
fi
# Checking all REMOTE_KEY_MANAGER_ENABLED parameters when SCNODE_REMOTE_KEY_MANAGER_ENABLED=true
if [ "${SCNODE_REMOTE_KEY_MANAGER_ENABLED:-}" = "true" ]; then
# Checking KEY_MANAGER_REQUEST_TIMEOUT
if [ -z "${SCNODE_REMOTE_KEY_MANAGER_REQUEST_TIMEOUT:-}" ]; then
echo "Error: When SCNODE_CERT_SIGNING_ENABLED=true and SCNODE_REMOTE_KEY_MANAGER_ENABLED=true, 'SCNODE_REMOTE_KEY_MANAGER_REQUEST_TIMEOUT' variable is required to be set."
sleep 5
exit 1
else
REMOTE_KEY_MANAGER_REQUEST_TIMEOUT="$(echo -en "\n requestTimeout = ${SCNODE_REMOTE_KEY_MANAGER_REQUEST_TIMEOUT}")"
export REMOTE_KEY_MANAGER_REQUEST_TIMEOUT
fi

if [ "${SCNODE_REMOTE_KEY_MANAGER_ENABLED:-}" = "true" ] && [ -z "${SCNODE_REMOTE_KEY_MANAGER_REQUEST_TIMEOUT:-}" ]; then
echo "Error: When SCNODE_CERT_SIGNING_ENABLED=true and SCNODE_REMOTE_KEY_MANAGER_ENABLED=true SCNODE_REMOTE_KEY_MANAGER_REQUEST_TIMEOUT needs to be set."
sleep 5
exit 1
elif [ "${SCNODE_REMOTE_KEY_MANAGER_ENABLED:-}" = "true" ] && [ -n "${SCNODE_REMOTE_KEY_MANAGER_REQUEST_TIMEOUT:-}" ]; then
if [ "${SCNODE_REMOTE_KEY_MANAGER_ENABLED:-}" = "true" ] && [ -n "${SCNODE_REMOTE_KEY_MANAGER_REQUEST_TIMEOUT:-}" ]; then
# setting SCNODE_REMOTE_KEY_MANAGER_REQUEST_TIMEOUT if provided
REMOTE_KEY_MANAGER_REQUEST_TIMEOUT=""
REMOTE_KEY_MANAGER_REQUEST_TIMEOUT="$(echo -en "\n requestTimeout = ${SCNODE_REMOTE_KEY_MANAGER_REQUEST_TIMEOUT}")"
export REMOTE_KEY_MANAGER_REQUEST_TIMEOUT
fi

if [ "${SCNODE_REMOTE_KEY_MANAGER_ENABLED:-}" = "true" ] && [ -z "${SCNODE_REMOTE_KEY_MANAGER_PARALLEL_REQUESTS:-}" ]; then
echo "Error: When SCNODE_CERT_SIGNING_ENABLED=true and SCNODE_REMOTE_KEY_MANAGER_ENABLED=true SCNODE_REMOTE_KEY_MANAGER_PARALLEL_REQUESTS needs to be set."
sleep 5
exit 1
# Checking KEY_MANAGER_PARALLEL_REQUESTS
if [ -z "${SCNODE_REMOTE_KEY_MANAGER_PARALLEL_REQUESTS:-}" ]; then
echo "Error: When SCNODE_CERT_SIGNING_ENABLED=true and SCNODE_REMOTE_KEY_MANAGER_ENABLED=true, 'SCNODE_REMOTE_KEY_MANAGER_PARALLEL_REQUESTS' variable is required to be set."
sleep 5
exit 1
else
REMOTE_KEY_MANAGER_PARALLEL_REQUESTS="$(echo -en "\n numOfParallelRequests = ${SCNODE_REMOTE_KEY_MANAGER_PARALLEL_REQUESTS}")"
export REMOTE_KEY_MANAGER_PARALLEL_REQUESTS
fi

if [ "${SCNODE_REMOTE_KEY_MANAGER_ENABLED:-}" = "true" ] && [ -n "${SCNODE_REMOTE_KEY_MANAGER_PARALLEL_REQUESTS:-}" ]; then
# setting SCNODE_REMOTE_KEY_MANAGER_PARALLEL_REQUESTS if provided
REMOTE_KEY_MANAGER_PARALLEL_REQUESTS=""
REMOTE_KEY_MANAGER_PARALLEL_REQUESTS="$(echo -en "\n numOfParallelRequests = ${SCNODE_REMOTE_KEY_MANAGER_PARALLEL_REQUESTS}")"
export REMOTE_KEY_MANAGER_PARALLEL_REQUESTS
fi
fi

# Checking REMOTE_KEY_MANAGER_ADDRESS and its connectivity
if [ -z "${SCNODE_REMOTE_KEY_MANAGER_ADDRESS:-}" ]; then
Expand All @@ -164,9 +171,11 @@ if [ "${SCNODE_CERT_SIGNING_ENABLED:-}" = "true" ]; then
exit 1
fi
done
fi
fi
fi
fi


if [ "${SCNODE_FORGER_ENABLED:-}" = "true" ] || [ "${SCNODE_CERT_SUBMITTER_ENABLED:-}" = "true" ]; then
if [ -z "${SCNODE_WS_ZEN_FQDN:-}" ]; then
echo "Error: Environment variable SCNODE_WS_ZEN_FQDN is required when SCNODE_FORGER_ENABLED=true or SCNODE_CERT_SUBMITTER_ENABLED=true."
Expand Down

0 comments on commit bcf5661

Please sign in to comment.