Files
PolyHermes/docker/start.sh
T
WrBug 7f85274a96 feat: 实现私钥加密存储功能
- 创建 CryptoUtils 加密工具类,支持 AES-256/CBC/PKCS5Padding 加密
- encryption.key 支持任意长度密钥(通过 SHA-256 哈希成 32 字节)
- 修改 AccountService,在保存时加密私钥,在使用时解密
- 修改 CopyOrderTrackingService,在使用私钥前先解密
- 更新 Account 实体注释,说明私钥已加密存储
- 添加向后兼容支持:如果私钥未加密(旧数据),直接返回明文
2025-12-03 06:02:26 +08:00

43 lines
963 B
Bash
Executable File

#!/bin/bash
# 启动脚本:同时启动 Nginx 和后端服务
set -e
# 函数:清理进程
cleanup() {
echo "收到退出信号,清理进程..."
if [ -n "$BACKEND_PID" ]; then
kill $BACKEND_PID 2>/dev/null || true
fi
nginx -s quit 2>/dev/null || true
exit 0
}
# 注册信号处理
trap cleanup SIGTERM SIGINT
# 启动后端服务(以 appuser 用户运行,后台运行)
echo "启动后端服务..."
java -jar /app/app.jar --spring.profiles.active=${SPRING_PROFILES_ACTIVE:-prod} &
BACKEND_PID=$!
# 等待后端服务启动
echo "等待后端服务启动..."
for i in {1..60}; do
if curl -f http://localhost:8000/api/health > /dev/null 2>&1; then
echo "后端服务已启动"
break
fi
if [ $i -eq 60 ]; then
echo "后端服务启动超时"
exit 1
fi
sleep 1
done
# 启动 Nginx(前台运行,作为主进程)
echo "启动 Nginx..."
exec nginx -g "daemon off;"