diff --git a/scripts/cloudron-setup b/scripts/cloudron-setup index 7cdb79129..15a1afd9b 100755 --- a/scripts/cloudron-setup +++ b/scripts/cloudron-setup @@ -215,11 +215,17 @@ mysql -uroot -ppassword -e "REPLACE INTO box.settings (name, value) VALUES ('web mysql -uroot -ppassword -e "REPLACE INTO box.settings (name, value) VALUES ('console_server_origin', '${consoleServerOrigin}');" 2>/dev/null if [[ -n "${appstoreSetupToken}" ]]; then - if ! setupResponse=$(curl -sX POST -H "Content-type: application/json" --data "{\"setupToken\": \"${appstoreSetupToken}\"}" "${apiServerOrigin}/api/v1/cloudron_setup_done"); then - echo "Could not complete setup. See ${LOG_FILE} for details" + if ! httpCode=$(curl -sX POST -H "Content-type: application/json" -o /tmp/response.json -w "%{http_code}" --data "{\"setupToken\": \"${appstoreSetupToken}\"}" "${apiServerOrigin}/api/v1/cloudron_setup_done"); then + echo "Could not reach ${apiServerOrigin} to complete setup. See ${LOG_FILE} for details" + exit 1 + fi + if [[ "${httpCode}" != "200" ]]; then + echo "Failed to validate setup token. See ${LOG_FILE} for details" + cat /tmp/response.json >> ${LOG_FILE} exit 1 fi + setupResponse=$(cat /tmp/response.json) cloudronId=$(echo "${setupResponse}" | python3 -c 'import json,sys;obj=json.load(sys.stdin);print(obj["cloudronId"])') mysql -uroot -ppassword -e "REPLACE INTO box.settings (name, value) VALUES ('cloudron_id', '${cloudronId}');" 2>/dev/null