#!/bin/bash

# BestCDN Run Script - Automatically activates virtual environment

echo "BestCDN Runner"
echo "=============="

# Check if virtual environment exists
if [ ! -d "venv" ]; then
    echo "Error: Virtual environment not found!"
    echo "Please run ./install.sh first"
    exit 1
fi

# Activate virtual environment
echo "Activating virtual environment..."
source venv/bin/activate

# Check if activation was successful
if [ $? -ne 0 ]; then
    echo "Error: Failed to activate virtual environment"
    exit 1
fi

echo "✓ Virtual environment activated"

# Run the example
echo "Running BestCDN example..."
python3 example_usage.py

# Deactivate virtual environment
deactivate