Files
akmon/push-receiver-service/start.bat
2026-01-20 08:04:15 +08:00

77 lines
1.8 KiB
Batchfile
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@echo off
REM 推送消息接收服务启动脚本 (Windows)
echo 🚀 启动推送消息接收服务...
REM 检查 Node.js 是否安装
node --version >nul 2>&1
if %errorlevel% neq 0 (
echo ❌ Node.js 未安装,请先安装 Node.js
pause
exit /b 1
)
REM 检查是否在正确的目录
if not exist "package.json" (
echo ❌ 请在 push-receiver-service 目录中运行此脚本
pause
exit /b 1
)
REM 安装依赖
echo 📦 安装依赖包...
npm install
if %errorlevel% neq 0 (
echo ❌ 依赖安装失败
pause
exit /b 1
)
REM 检查环境配置
if not exist ".env" (
echo ⚠️ 未找到 .env 文件,复制模板...
if exist ".env.supabase" (
copy .env.supabase .env
echo 📋 已复制 .env.supabase 为 .env请编辑配置
echo - SUPABASE_URL: 您的 Supabase 项目 URL
echo - SUPABASE_SERVICE_ROLE_KEY: 您的 Service Role Key
echo - API_KEY: 自定义 API 密钥
set /p confirm="是否已配置完成环境变量?(y/n): "
if /i not "%confirm%"=="y" (
echo ❌ 请先配置环境变量再启动服务
pause
exit /b 1
)
) else (
echo ❌ 未找到环境配置模板文件
pause
exit /b 1
)
)
REM 初始化数据库
echo 🗄️ 初始化 Supabase 数据库...
node setup-supabase.js
if %errorlevel% neq 0 (
echo ❌ 数据库初始化失败,请检查配置
pause
exit /b 1
)
REM 运行测试
echo 🧪 运行基础测试...
node test.js
if %errorlevel% neq 0 (
echo ⚠️ 测试有错误,但继续启动服务...
)
REM 启动服务
echo 🚀 启动推送消息接收服务...
echo 📍 服务将在 http://localhost:3001 启动
echo 💡 按 Ctrl+C 停止服务
echo.
node supabase-server.js
pause