fix: make try target auto-starts stack and uses correct API paths
The try and session targets were hitting /sessions directly instead of /api/sessions (Caddy strips the /api prefix before proxying). Also, try now depends on up and waits for health check before creating a session.
This commit is contained in:
17
Makefile
17
Makefile
@@ -29,14 +29,19 @@ logs:
|
|||||||
# Create a new session and display its info
|
# Create a new session and display its info
|
||||||
session:
|
session:
|
||||||
@echo "Creating new session..."
|
@echo "Creating new session..."
|
||||||
@curl -s -X POST http://localhost:8080/sessions | jq .
|
@curl -s -X POST http://localhost:8080/api/sessions | jq .
|
||||||
|
|
||||||
# Try the web interface - creates a session and opens it
|
# Try the web interface - starts stack, creates a session and opens it
|
||||||
try:
|
try: up
|
||||||
|
@echo "Waiting for services to be ready..."
|
||||||
|
@for i in $$(seq 1 30); do \
|
||||||
|
curl -sf http://localhost:8080/api/health >/dev/null 2>&1 && break; \
|
||||||
|
sleep 1; \
|
||||||
|
done
|
||||||
@echo "Creating session and opening web interface..."
|
@echo "Creating session and opening web interface..."
|
||||||
@SESSION_ID=$$(curl -s -X POST http://localhost:8080/sessions | jq -r '.session_id') && \
|
@SESSION_ID=$$(curl -s -X POST http://localhost:8080/api/sessions | jq -r '.session_id') && \
|
||||||
echo "Session created: $$SESSION_ID" && \
|
echo "Session created: $$SESSION_ID" && \
|
||||||
echo "Opening http://localhost:8080/session/$$SESSION_ID" && \
|
echo "Opening http://localhost:8080/session/$$SESSION_ID" && \
|
||||||
xdg-open "http://localhost:8080/session/$$SESSION_ID" 2>/dev/null || \
|
(xdg-open "http://localhost:8080/session/$$SESSION_ID" 2>/dev/null || \
|
||||||
open "http://localhost:8080/session/$$SESSION_ID" 2>/dev/null || \
|
open "http://localhost:8080/session/$$SESSION_ID" 2>/dev/null || \
|
||||||
echo "Visit: http://localhost:8080/session/$$SESSION_ID"
|
echo "Visit: http://localhost:8080/session/$$SESSION_ID")
|
||||||
|
|||||||
Reference in New Issue
Block a user