#!/bin/sh
# Entrypoint: start the Wisen background fetcher AND the proxy web server
cd /app

# Launch the Wisen data fetcher in the background
if [ -f "src/wisen_fetcher.rb" ]; then
    echo "[entrypoint] Using updated fetcher from src/"
    ruby src/wisen_fetcher.rb &
else
    ruby wisen_fetcher.rb &
fi
FETCHER_PID=$!
echo "[entrypoint] Wisen fetcher started (PID $FETCHER_PID)"

# Launch the proxy web server
exec ruby wisen_proxy_server.rb
