diff --git a/tools/bin/cli.sh b/tools/bin/cli.sh index b194155e293c..e4c7ccb3cbcd 100755 --- a/tools/bin/cli.sh +++ b/tools/bin/cli.sh @@ -8,10 +8,16 @@ IMAGE_RESTISH_PATH=/root/.restish/apis.json DOWNLOADED_CONFIG_PATH=/tmp/downloaded-airbyte-api-config IMAGE_CONFIG_PATH=/tmp/config.yaml -API_URL=http://localhost:8001 -curl -s "$API_URL"/api/v1/openapi -o "$DOWNLOADED_CONFIG_PATH" +if [ ! -f "$LOCAL_RESTISH_PATH" ]; then + API_URL="${API_URL:-http://localhost:8001}" + if ! curl -s "${API_URL}/api/v1/openapi" -o "$DOWNLOADED_CONFIG_PATH"; then + 2>&1 echo "ERROR: failed to download config file from ${API_URL}/api/v1/openapi" + 2>&1 echo " if the API is elsewhere you can specify it using:" + 2>&1 echo " API_URL=XXX $0" + exit 1 + fi -cat > "$LOCAL_RESTISH_PATH" < "$LOCAL_RESTISH_PATH" < "$LOCAL_RESTISH_PATH" <