/ docker / detect-wave.sh
detect-wave.sh
 1  #!/bin/bash
 2  # Auto-enable 'wave' profile if image is accessible
 3  
 4  # Default tag to main if not set
 5  WAVE_TAG=${WAVE_TAG:-main}
 6  
 7  # if PUBLIC_WAVE_API_URL and PUBLIC_INTERNAL_WAVE_API_URL are set, skip detection
 8  if [ -n "${PUBLIC_WAVE_API_URL:-}" ] && [ -n "${PUBLIC_INTERNAL_WAVE_API_URL:-}" ]; then
 9    echo "PUBLIC_WAVE_API_URL and PUBLIC_INTERNAL_WAVE_API_URL are set. Skipping Wave service detection."
10  else
11    # Check if we can access the image manifest
12    if docker manifest inspect "j537/wave:$WAVE_TAG" > /dev/null 2>&1; then
13      echo "🌊 Access to 'j537/wave:$WAVE_TAG' confirmed."
14  
15      if [ -z "${COMPOSE_PROFILES:-}" ]; then
16        echo "Enabling 'wave' profile."
17        export COMPOSE_PROFILES=wave
18      elif [[ ",${COMPOSE_PROFILES}," != *",wave,"* ]]; then
19        echo "Adding 'wave' to existing profiles."
20        export COMPOSE_PROFILES="${COMPOSE_PROFILES},wave"
21      fi
22    else
23      echo "⚠️  No access to 'j537/wave:$WAVE_TAG'. Wave service will not be enabled."
24    fi
25  fi