Search/run.sh

42 lines
744 B
Bash
Executable file

#!/bin/sh
# Initialize variables
SKIP_CONFIG=""
PORT=""
DOMAIN=""
# Parse arguments
while [ $# -gt 0 ]; do
case $1 in
--port)
PORT=$2
shift 2
;;
--domain)
DOMAIN=$2
shift 2
;;
--skip-config-check)
SKIP_CONFIG="--skip-config-check"
shift
;;
*)
echo "Unknown argument: $1"
exit 1
;;
esac
done
# List all Go files in this directory
GO_FILES=$(find . -name '*.go' -print)
# Construct the command
CMD="go run $GO_FILES $SKIP_CONFIG"
[ -n "$PORT" ] && CMD="$CMD --port $PORT"
[ -n "$DOMAIN" ] && CMD="$CMD --domain $DOMAIN"
# Informative output
echo "Starting application with command: $CMD"
# Run the Go program with the constructed command
eval $CMD