topfans/backend/services/socialService/start.sh
2026-04-07 22:29:48 +08:00

41 lines
794 B
Bash
Executable File

#!/bin/bash
# Social Service 启动脚本
# 设置环境变量
export ENV=development
export LOG_LEVEL=debug
# 数据库配置
DB_HOST=${DB_HOST:-localhost}
DB_PORT=${DB_PORT:-5432}
DB_USER=${DB_USER:-haihuizhu}
DB_PASSWORD=${DB_PASSWORD:-admin}
DB_NAME=${DB_NAME:-top-fans}
# 服务配置
SERVICE_PORT=${SERVICE_PORT:-20001}
USER_SERVICE_URL=${USER_SERVICE_URL:-tri://localhost:20000}
# 编译
echo "Building Social Service..."
go build -o socialService main.go
if [ $? -ne 0 ]; then
echo "Build failed!"
exit 1
fi
echo "Starting Social Service..."
# 运行服务
./socialService \
-port=${SERVICE_PORT} \
-db-host=${DB_HOST} \
-db-port=${DB_PORT} \
-db-user=${DB_USER} \
-db-password=${DB_PASSWORD} \
-db-name=${DB_NAME} \
-user-service-url=${USER_SERVICE_URL}