-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun.sh
More file actions
84 lines (74 loc) · 1.61 KB
/
Copy pathrun.sh
File metadata and controls
84 lines (74 loc) · 1.61 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
#!/bin/bash
# Build command arguments from environment variables
ARGS=()
# Handle different modes based on MODE environment variable
case "$MODE" in
"server")
# Server mode
if [ -n "$PORT" ]; then
ARGS+=("--live" "$PORT")
else
ARGS+=("--live" "8090")
fi
;;
"client")
# Client mode
if [ -n "$KEY" ]; then
ARGS+=("--connect" "$KEY")
fi
if [ -n "$PORT" ]; then
ARGS+=("--port" "$PORT")
fi
;;
"filemanager")
# Filemanager mode
if [ -n "$DIR" ]; then
ARGS+=("--filemanager" "$DIR")
fi
if [ -n "$PORT" ]; then
ARGS+=("--port" "$PORT")
fi
if [ -n "$USERNAME" ]; then
ARGS+=("--username" "$USERNAME")
fi
if [ -n "$PASSWORD" ]; then
ARGS+=("--password" "$PASSWORD")
fi
if [ -n "$ROLE" ]; then
ARGS+=("--role" "$ROLE")
fi
;;
*)
# Default server mode if MODE not specified
if [ -n "$PORT" ]; then
ARGS+=("--live" "$PORT")
else
ARGS+=("--live" "8090")
fi
;;
esac
# Add optional arguments based on environment variables
if [ -n "$HOST" ]; then
ARGS+=("--host" "$HOST")
fi
if [ -n "$KEY" ] && [ "$MODE" != "client" ]; then
ARGS+=("--key" "$KEY")
fi
if [ -n "$HOLESAIL_KEY" ]; then
ARGS+=("--key" "$HOLESAIL_KEY")
fi
if [ "$PUBLIC" = "true" ]; then
ARGS+=("--public")
fi
if [ "$FORCE" = "true" ]; then
ARGS+=("--force")
fi
if [ "$LOG" = "true" ] || [ "$LOG" = "1" ]; then
ARGS+=("--log")
elif [ -n "$LOG" ] && [ "$LOG" != "false" ] && [ "$LOG" != "0" ]; then
ARGS+=("--log" "$LOG")
fi
# Debug output
echo "Starting holesail with: node src/bin/holesail.mjs ${ARGS[*]}"
# Execute the holesail command
exec node src/bin/holesail.mjs "${ARGS[@]}"