#!/bin/bash # Default values SERVER_URL="http://localhost:8080" PORT="8000" # Parse command line arguments while [[ $# -gt 0 ]]; do case $1 in --server-url) SERVER_URL="$2" shift 2 ;; --port) PORT="$2" shift 2 ;; -h|--help) echo "Usage: $0 [OPTIONS]" echo "" echo "Options:" echo " --server-url URL Backend server URL (default: http://localhost:8080)" echo " --port PORT Frontend port (default: 8000)" echo " -h, --help Show this help message" exit 0 ;; *) echo "Unknown option: $1" echo "Use --help for usage information" exit 1 ;; esac done # Check for environment variable override if [ ! -z "$SELF_SERVER_URL" ]; then SERVER_URL="$SELF_SERVER_URL" fi if [ ! -z "$SELF_PORT" ]; then PORT="$SELF_PORT" fi echo "🚀 Starting Self Identity App" echo "📡 Frontend port: $PORT" echo "🔗 Backend server: $SERVER_URL" # Export environment variable for the build export SERVER_URL="$SERVER_URL" # Start trunk serve with custom port trunk serve --port "$PORT"