fix(config):enforce encryption setup (#808)

* enforce encryption setup

* comment
This commit is contained in:
Diego
2025-11-08 23:04:23 -05:00
committed by GitHub
parent 3112250635
commit 1d5470f867

View File

@@ -102,27 +102,18 @@ check_encryption() {
need_setup=true need_setup=true
fi fi
# 如果需要设置加密环境 # 如果需要设置加密环境,直接自动设置
if [ "$need_setup" = "true" ]; then if [ "$need_setup" = "true" ]; then
print_info "🔐 需要设置加密环境" print_info "🔐 检测到加密环境未配置,正在自动设置..."
print_info "加密环境用于保护敏感数据API密钥、私钥等" print_info "加密环境用于保护敏感数据API密钥、私钥等"
echo "" echo ""
# 询问用户是否自动设置
read -p "是否自动设置加密环境?[Y/n]: " auto_setup
auto_setup=${auto_setup:-Y}
if [[ "$auto_setup" =~ ^[Yy]$ ]]; then
print_info "正在设置加密环境..."
# 检查加密设置脚本是否存在 # 检查加密设置脚本是否存在
if [ -f "scripts/setup_encryption.sh" ]; then if [ -f "scripts/setup_encryption.sh" ]; then
print_info "正在自动设置加密环境..."
print_info "加密系统将保护: API密钥、私钥、Hyperliquid代理钱包" print_info "加密系统将保护: API密钥、私钥、Hyperliquid代理钱包"
echo "" echo ""
# 自动运行加密设置脚本 # 自动运行加密设置脚本
# Y: 继续设置加密环境 | n: 保持现有RSA密钥 | n: 保持现有密钥配置
echo -e "Y\nn\nn" | bash scripts/setup_encryption.sh echo -e "Y\nn\nn" | bash scripts/setup_encryption.sh
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "" echo ""
@@ -141,11 +132,6 @@ check_encryption() {
print_info "请手动运行: ./scripts/setup_encryption.sh" print_info "请手动运行: ./scripts/setup_encryption.sh"
exit 1 exit 1
fi fi
else
print_warning "跳过加密环境设置"
print_info "手动设置命令: ./scripts/setup_encryption.sh"
print_info "系统将使用未加密模式运行(不推荐)"
fi
else else
print_success "🔐 加密环境已配置" print_success "🔐 加密环境已配置"
print_info " • RSA密钥对: secrets/rsa_key + secrets/rsa_key.pub" print_info " • RSA密钥对: secrets/rsa_key + secrets/rsa_key.pub"