Files

16 lines
977 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
# 米图设计(8126)重启脚本:注入授权中心 env 并重建容器。
# KEY 不落明文文件:每次从 CardAuth 库(HEX)经 SSH 读取注入——明文经终端/文本通道会被打码(403 的坑),勿手工写。
set -e
cd "$(dirname "$0")"
KEY=$(ssh -i /root/.ssh/cardauth_vps -o StrictHostKeyChecking=no root@43.163.242.147 \
"docker exec cardauth-db sh -c 'mysql -uroot -p\$MYSQL_ROOT_PASSWORD card_auth -N -e \"SELECT HEX(api_key) FROM ca_projects WHERE id=10;\" 2>/dev/null'" | tail -1)
KEY=$(python3 -c "import sys;print(bytes.fromhex('$KEY').decode())" 2>/dev/null || python3 -c "import sys;print(bytes.fromhex(sys.argv[1]).decode())" "$KEY")
[ -n "$KEY" ] || { echo "读取授权KEY失败"; exit 1; }
export HUB_API_KEY="$KEY"
export HUB_PROJECT_ID=10
export HUB_HOST=https://auth.88531.cn
export VERSION=${VERSION:-1.0.0}
docker compose -f docker-compose.cover.yml up -d "$@"
echo "kuaitu-editor 已重建(hub keylen=${#KEY})"