contentSecurity/run.sh
2025-10-15 14:52:37 +08:00

42 lines
879 B
Bash
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.

#!/bin/bash
echo "=== 阿里云内容安全2.0 Demo ==="
echo
# 检查Go是否安装
if ! command -v go &> /dev/null; then
echo "❌ 错误: 未找到Go请先安装Go 1.21或更高版本"
exit 1
fi
echo "✅ Go环境检查通过"
echo
# 下载依赖
echo "正在下载依赖..."
go mod tidy
if [ $? -ne 0 ]; then
echo "❌ 依赖下载失败"
exit 1
fi
echo "✅ 依赖下载完成"
echo
# 检查环境变量
if [ -z "$ALIBABA_CLOUD_ACCESS_KEY_ID" ]; then
echo "⚠️ 警告: 未设置 ALIBABA_CLOUD_ACCESS_KEY_ID 环境变量"
echo "请设置环境变量或创建.env文件"
echo
fi
if [ -z "$ALIBABA_CLOUD_ACCESS_KEY_SECRET" ]; then
echo "⚠️ 警告: 未设置 ALIBABA_CLOUD_ACCESS_KEY_SECRET 环境变量"
echo "请设置环境变量或创建.env文件"
echo
fi
# 运行程序
echo "启动程序..."
go run cmd/main.go