#!/usr/bin/env bash
set -e
cd "$(dirname "$0")"
command -v php >/dev/null || { echo "ERROR: PHP no está instalado."; exit 1; }
php api/peer_daemon.php >> storage/peer-daemon-console.log 2>&1 &
DAEMON_PID=$!
trap 'kill "$DAEMON_PID" 2>/dev/null || true' EXIT INT TERM
echo "SIAPA disponible en http://localhost:8080"
php -S 0.0.0.0:8080 router.php
