Files
AI-Testing/scripts/bootstrap-env.sh
2026-04-18 20:20:38 +08:00

16 lines
476 B
Bash
Executable File
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.
#!/usr/bin/env bash
# 若项目根不存在 .env则从 .env.example 复制(供 docker compose / 本地工具使用)
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"
if [[ -f ".env" ]]; then
echo ".env 已存在,跳过"
exit 0
fi
if [[ ! -f ".env.example" ]]; then
echo "错误: 未找到 .env.example" >&2
exit 1
fi
cp .env.example .env
echo "已创建 .env来自 .env.example请编辑 .env 填写密钥等信息"