Elysiadev11 commited on
Commit
dec7538
ยท
verified ยท
1 Parent(s): d01a676

Create start-hf.sh

Browse files
Files changed (1) hide show
  1. start-hf.sh +33 -0
start-hf.sh ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ # ============================================================
3
+ # start-hf.sh - Startup script untuk Hugging Face Spaces
4
+ # Set BASE_URL otomatis dari environment SPACE_HOST HF
5
+ # ============================================================
6
+
7
+ # Jika SPACE_HOST tersedia (otomatis dari HF Spaces), set BASE_URL
8
+ if [ -n "$SPACE_HOST" ]; then
9
+ export BASE_URL="https://${SPACE_HOST}"
10
+ export NEXT_PUBLIC_BASE_URL="https://${SPACE_HOST}"
11
+ echo "โœ… BASE_URL set to: $BASE_URL"
12
+ else
13
+ # Fallback jika tidak ada SPACE_HOST
14
+ export BASE_URL="http://localhost:7860"
15
+ export NEXT_PUBLIC_BASE_URL="http://localhost:7860"
16
+ echo "โš ๏ธ SPACE_HOST not found, using localhost"
17
+ fi
18
+
19
+ export NEXT_PUBLIC_CLOUD_URL="https://9router.com"
20
+ export CLOUD_URL="https://9router.com"
21
+
22
+ echo "๐Ÿš€ Starting 9Router..."
23
+ echo " PORT : $PORT"
24
+ echo " BASE_URL : $BASE_URL"
25
+ echo " DATA_DIR : $DATA_DIR"
26
+ echo " NODE_ENV : $NODE_ENV"
27
+ echo ""
28
+ echo "๐Ÿ“Š Dashboard : ${BASE_URL}/dashboard"
29
+ echo "๐Ÿ”Œ API : ${BASE_URL}/v1"
30
+ echo ""
31
+
32
+ # Start Next.js production server
33
+ exec npm run start