Fix jwt-token
This commit is contained in:
@@ -1,15 +1,30 @@
|
||||
#!/bin/bash
|
||||
# Simple bash script to test drone detection API with curl
|
||||
|
||||
API_BASE="http://selfservice.cqers.com/drones/api"
|
||||
# Alternative for local testing: "http://localhost:3002/api"
|
||||
# Load environment variables from .env file if it exists
|
||||
if [ -f ".env" ]; then
|
||||
export $(grep -v '^#' .env | xargs)
|
||||
fi
|
||||
|
||||
# Configuration from environment variables
|
||||
API_BASE_URL=${API_BASE_URL:-"http://localhost:3002/api"}
|
||||
BASE_PATH=${VITE_BASE_PATH:-""}
|
||||
|
||||
# If BASE_PATH is set, construct the full URL
|
||||
if [ ! -z "$BASE_PATH" ] && [[ ! "$API_BASE_URL" == *"/api" ]]; then
|
||||
# Remove any existing path suffixes and add base path
|
||||
DOMAIN=$(echo "$API_BASE_URL" | sed 's|/api$||' | sed 's|/drones/api$||' | sed 's|/uggla/api$||')
|
||||
API_BASE_URL="${DOMAIN}${BASE_PATH}/api"
|
||||
fi
|
||||
|
||||
echo "🚁 Drone Detection API Test Script"
|
||||
echo "=================================="
|
||||
echo "🔗 Using API Base URL: $API_BASE_URL"
|
||||
echo ""
|
||||
|
||||
# Test API health
|
||||
echo "🔍 Testing API health..."
|
||||
curl -s "$API_BASE/health" | jq '.' || echo "Health check failed"
|
||||
curl -s "$API_BASE_URL/health" | jq '.' || echo "Health check failed"
|
||||
echo ""
|
||||
|
||||
# Send test detection data
|
||||
@@ -39,7 +54,7 @@ echo ""
|
||||
# Send the detection
|
||||
echo "Sending detection..."
|
||||
RESPONSE=$(curl -s -w "\nHTTP_STATUS:%{http_code}" \
|
||||
-X POST "$API_BASE/detections" \
|
||||
-X POST "$API_BASE_URL/detectors" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$DETECTION_DATA")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user