#!/bin/bash

# Add custom Stoobly configuration here

scheme=$SERVICE_SCHEME
hostname=$SERVICE_HOSTNAME
port=$SERVICE_PORT

url="$scheme://$hostname"

if [ "$scheme" = 'http' -a "$port" != '80' ] || [ "$scheme" = 'https' -a "$port" != '443' ]; then
  url="$url:$port"
fi

# Match Rules
echo "Configuring match rules"
stoobly-agent config match set \
  --method GET --method POST --method OPTIONS --method PUT --method DELETE \
  --mode mock \
  --pattern ".*?"