-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·97 lines (83 loc) · 2.43 KB
/
run.sh
File metadata and controls
executable file
·97 lines (83 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
set -e
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
# Default values
PORT="${PORT:-3000}"
BLOB_PATH="${BLOB_PATH:-./blobs}"
LOG_LEVEL="${LOG_LEVEL:-info}"
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
--port)
PORT="$2"
shift 2
;;
--blob)
BLOB_PATH="$2"
shift 2
;;
--blob-dir)
BLOB_PATH="$2"
shift 2
;;
--log-level)
LOG_LEVEL="$2"
shift 2
;;
--help)
echo "Usage: $0 [options]"
echo ""
echo "Options:"
echo " --port PORT Server port (default: 3000)"
echo " --blob PATH Blob file path (single file mode)"
echo " --blob-dir PATH Blob directory path (directory mode, default: ./blobs)"
echo " --log-level LEVEL Log level: error, warn, info, debug, trace (default: info)"
echo " --help Show this help message"
exit 0
;;
*)
echo -e "${RED}Unknown option: $1${NC}"
exit 1
;;
esac
done
echo -e "${GREEN}Starting KURPOD development server...${NC}"
# Always rebuild frontend and backend for development
echo -e "${YELLOW}Building project...${NC}"
# Build frontend
echo -e "${BLUE}Building frontend...${NC}"
cd frontend
if [ ! -d "node_modules" ]; then
echo -e "${YELLOW}Installing frontend dependencies...${NC}"
bun install
fi
bun run build
cd ..
# Build backend in debug mode
echo -e "${BLUE}Building backend...${NC}"
cargo build -p kurpod_server
# Create blob directory if it doesn't exist
if [ ! -d "$BLOB_PATH" ]; then
echo -e "${YELLOW}Creating blob storage directory: $BLOB_PATH${NC}"
mkdir -p "$BLOB_PATH"
fi
# Set environment variables
export RUST_LOG="kurpod_server=$LOG_LEVEL,encryption_core=$LOG_LEVEL"
export KURPOD_PORT="$PORT"
export KURPOD_BLOB_PATH="$BLOB_PATH"
# Start the server
echo -e "${GREEN}Server configuration:${NC}"
echo -e " Port: ${BLUE}$PORT${NC}"
echo -e " Blob path: ${BLUE}$BLOB_PATH${NC}"
echo -e " Log level: ${BLUE}$LOG_LEVEL${NC}"
echo ""
echo -e "${GREEN}Server starting at: ${BLUE}http://localhost:$PORT${NC}"
echo -e "${YELLOW}Press Ctrl+C to stop${NC}"
echo ""
# Run the server
cargo run -p kurpod_server -- --port "$PORT" --dir "$BLOB_PATH"