#!/usr/bin/env bash # ./scripts/run.sh [profiles] # # ./scripts/run.sh auth the provider on :9000 # ./scripts/run.sh auth nopkce the provider with PKCE not required # ./scripts/run.sh rs the API on :8090 # ./scripts/run.sh client the relying party on :8080 set -eu cd "$(dirname "$0")/.." . scripts/lib.sh case "${1:-}" in auth) MODULE=auth-server; MAIN=AuthServerApplication; PORT=9000 ;; rs) MODULE=resource-server; MAIN=ResourceServerApplication; PORT=8090 ;; client) MODULE=oidc-client; MAIN=ClientApplication; PORT=8080 ;; *) echo "usage: $0 [profiles]" >&2; exit 2 ;; esac PROFILES="${2:-}" kill_app "$MAIN" "$PORT" LOG="/tmp/${MODULE}.log" ARGS=(-B -pl "$MODULE" org.springframework.boot:spring-boot-maven-plugin:run) [ -n "$PROFILES" ] && ARGS+=("-Dspring-boot.run.profiles=$PROFILES") # Detached, so the script returns and the demo scripts can drive it. setsid nohup mvn "${ARGS[@]}" > "$LOG" 2>&1 < /dev/null & echo "starting $MODULE${PROFILES:+ [$PROFILES]} -> $LOG" wait_for "http://localhost:$PORT/" 120 && echo "$MODULE up on :$PORT"