feat: expose boss via nginx base path
This commit is contained in:
@@ -6,6 +6,12 @@ data_dir="${BOSS_DATA_DIR:-.boss-data}"
|
||||
data_file="${BOSS_DATA_FILE:-$data_dir/server-store.json}"
|
||||
pid_file="${BOSS_PID_FILE:-$data_dir/server.pid}"
|
||||
log_file="${BOSS_LOG_FILE:-$data_dir/server.log}"
|
||||
base_path="${BOSS_BASE_PATH:-}"
|
||||
if [[ -n "$base_path" && "$base_path" != /* ]]; then
|
||||
base_path="/$base_path"
|
||||
fi
|
||||
base_path="${base_path%/}"
|
||||
health_url="http://127.0.0.1:${port}${base_path}/api/health"
|
||||
|
||||
mkdir -p "$data_dir"
|
||||
|
||||
@@ -27,7 +33,7 @@ nohup env PORT="$port" BOSS_DATA_FILE="$data_file" node dist/server.js >>"$log_f
|
||||
echo $! > "$pid_file"
|
||||
|
||||
for _ in {1..30}; do
|
||||
if curl -fsS "http://127.0.0.1:${port}/api/health" >/dev/null 2>&1; then
|
||||
if curl -fsS "$health_url" >/dev/null 2>&1; then
|
||||
echo "Boss server started on :${port}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user