Search/run.sh

43 lines
744 B
Bash
Raw Normal View History

2024-06-15 18:12:01 +02:00
#!/bin/sh
2024-04-10 22:40:12 +02:00
# 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
2024-10-22 21:58:06 +02:00
GO_FILES=$(find . -name '*.go' -print)
2024-06-29 21:27:48 +02:00
# 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