Files
Toju/dev.sh
2026-03-02 00:13:34 +01:00

37 lines
946 B
Bash
Executable File

#!/usr/bin/env bash
# Launch the full dev stack, respecting SSL= from .env
set -e
DIR="$(cd "$(dirname "$0")" && pwd)"
# Load .env
if [ -f "$DIR/.env" ]; then
set -a
source "$DIR/.env"
set +a
fi
SSL="${SSL:-false}"
if [ "$SSL" = "true" ]; then
# Ensure certs exist
if [ ! -f "$DIR/.certs/localhost.crt" ]; then
echo "SSL=true but no certs found. Generating..."
"$DIR/generate-cert.sh"
fi
NG_SERVE="ng serve --host=0.0.0.0 --ssl --ssl-cert=.certs/localhost.crt --ssl-key=.certs/localhost.key"
WAIT_URL="https://localhost:4200"
HEALTH_URL="https://localhost:3001/api/health"
export NODE_TLS_REJECT_UNAUTHORIZED=0
else
NG_SERVE="ng serve --host=0.0.0.0"
WAIT_URL="http://localhost:4200"
HEALTH_URL="http://localhost:3001/api/health"
fi
exec npx concurrently --kill-others \
"cd server && npm run dev" \
"$NG_SERVE" \
"wait-on $WAIT_URL $HEALTH_URL && cross-env NODE_ENV=development SSL=$SSL electron ."