chore(init): 初始化解忧商行项目并完成 Phase 0 基座
This commit is contained in:
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
ENV_FILE="${ROOT_DIR}/backend/.env"
|
||||
|
||||
if [[ ! -f "${ENV_FILE}" ]]; then
|
||||
printf '缺少 %s,请先复制 backend/.env.example 并填写开发配置\n' "${ENV_FILE}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 逐行 export,避免 MYSQL_DSN 中的 & 和括号被 shell 当成语法。
|
||||
while IFS= read -r line || [[ -n "${line}" ]]; do
|
||||
[[ -z "${line}" || "${line}" =~ ^[[:space:]]*# ]] && continue
|
||||
line="${line#export }"
|
||||
export "${line}"
|
||||
done < "${ENV_FILE}"
|
||||
|
||||
cd "${ROOT_DIR}/backend"
|
||||
exec go run ./cmd/api
|
||||
Reference in New Issue
Block a user