Fix jwt-token

This commit is contained in:
2025-09-07 09:07:40 +02:00
parent af072b74fd
commit 3d4ea88269
6 changed files with 178 additions and 11 deletions

View File

@@ -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")