Files
huike-back/cp_envs_moicen_huiwings_databases.sh
T
weli dcb0d3c365 chore(moicen): add env/bootstrap scripts for split AuthCore layout
Make moicen env copying compatible with sibling AuthCore repo and add start/stop/build helper scripts for huiwings stack bring-up on moicen hosts.

Made-with: Cursor
2026-04-25 15:06:11 +08:00

37 lines
1.5 KiB
Bash
Executable File
Raw 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 sh
# 在 **moicen 本机** 使用:连接 localhost 的 *_huiwings(与 alchemy 上库名、与你导入的数据一致),
# 并沿用 moicen 的对外域名(*.moicen.com),代替 cp_envs_moicen.sh 里默认的 *_moicen 库名。
# 在 monorepo 的 **huike-back** 目录下执行;若同级的 ../AuthCore 存在,则一并写 UC。
set -e
HUIHUI="envs/huiwings"
# 与 envs/moicen 一致,仅数据库部分改为 huiwings
_transform() {
sed -e 's/\.huiwings\.cn/.moicen.com/g' "$1"
}
HIKE="."
[ -d "$HUIHUI" ] || { echo "在 huike-back 根目录执行"; exit 1; }
if [ -d "$HIKE/htyws" ]; then
_transform "$HUIHUI/htyws.env" > "$HIKE/htyws/.env"
_transform "$HUIHUI/htyws.env" > "$HIKE/htyws_models/.env"
fi
if [ -d "$HIKE/htykc" ]; then
_transform "$HUIHUI/htykc.env" > "$HIKE/htykc/.env"
_transform "$HUIHUI/htykc.env" > "$HIKE/htykc_models/.env"
fi
if [ -d "$HIKE/htyts" ]; then
_transform "$HUIHUI/htyts.env" > "$HIKE/htyts/.env"
_transform "$HUIHUI/htyts.env" > "$HIKE/htyts_models/.env"
fi
if [ -d "$HIKE/htyproc" ] && [ -f "$HUIHUI/htyproc.env" ]; then
_transform "$HUIHUI/htyproc.env" > "$HIKE/htyproc/.env"
fi
AUTH=../AuthCore
if [ -d "$AUTH/htyuc" ]; then
_transform "$HUIHUI/htyuc.env" > "$AUTH/htyuc/.env"
_transform "$HUIHUI/htyuc.env" > "$AUTH/htyuc_models/.env"
# 若从 AuthCore 根 `cargo run -p htyuc`cwd=AuthCore),dotenv 读此文件
_transform "$HUIHUI/htyuc.env" > "$AUTH/.env"
fi
echo "OK. Wrote .env (postgres *_huiwings + *.moicen.com) under huike-back and ../AuthCore if present."