#!/bin/bash
# hzhub-gateway 启动脚本

cd "$(dirname "$0")"

mkdir -p logs

# JWT 密钥（必须 >= 32 字节，与 hzhub-system/hzhub-ai 保持一致）
export JWT_SECRET="${JWT_SECRET:-Om1fovSeKIA1oLIoHdDPMF-trbqbrPQoDS3H4u1xoRY}"

echo "Starting hzhub-gateway..."

nohup mvn spring-boot:run -Dspring-boot.run.profiles=dev > logs/gateway.log 2>&1 &

echo $! > logs/gateway.pid
echo "hzhub-gateway started with PID $(cat logs/gateway.pid)"
echo "View logs with: tail -f logs/gateway.log"
