From 07eeb0fd99f03bb953033abe93357fa320294eca Mon Sep 17 00:00:00 2001 From: sdohuajia <63113882+sdohuajia@users.noreply.github.com> Date: Sat, 27 Jul 2024 17:20:44 +0800 Subject: [PATCH] Update Waku.sh --- Waku.sh | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/Waku.sh b/Waku.sh index 84d1e49..e46d632 100644 --- a/Waku.sh +++ b/Waku.sh @@ -13,7 +13,8 @@ function main_menu() { echo "请选择要执行的操作:" echo "1. 安装节点" echo "2. 修复错误" - echo "3. 退出" + echo "3. 编辑 .env 文件" + echo "4. 退出" read -rp "请输入操作选项:" choice case $choice in @@ -24,6 +25,9 @@ function main_menu() { fix_errors ;; 3) + edit_env_file + ;; + 4) echo "退出脚本,谢谢使用!" exit 0 ;; @@ -74,22 +78,7 @@ function install_node() { cd nwaku-compose cp .env.example .env - # 获取用户输入 - read -rp "请输入 ETH_CLIENT_ADDRESS(Sepolia ETH 的 RPC 地址):" ETH_CLIENT_ADDRESS - read -rp "请输入 ETH_TESTNET_KEY(有测试网 ETH 的私钥):" ETH_TESTNET_KEY - read -rp "请输入 RLN_RELAY_CRED_PASSWORD(设置密码):" RLN_RELAY_CRED_PASSWORD - - # 替换.env文件中的内容 - sed -i "s|ETH_CLIENT_ADDRESS=.*|RLN_RELAY_ETH_CLIENT_ADDRESS=$ETH_CLIENT_ADDRESS|" .env - sed -i "s|ETH_TESTNET_KEY=.*|ETH_TESTNET_KEY=$ETH_TESTNET_KEY|" .env - sed -i "s|RLN_RELAY_CRED_PASSWORD=.*|RLN_RELAY_CRED_PASSWORD=$RLN_RELAY_CRED_PASSWORD|" .env - - echo "已将以下内容写入 .env 文件:" - echo "RLN_RELAY_ETH_CLIENT_ADDRESS=$ETH_CLIENT_ADDRESS" - echo "ETH_TESTNET_KEY=$ETH_TESTNET_KEY" - echo "RLN_RELAY_CRED_PASSWORD=$RLN_RELAY_CRED_PASSWORD" - - echo "请继续编辑.env文件(如果需要):" + echo "请编辑 .env 文件并填写所需的信息:" echo "nano .env" # 注册节点 @@ -128,5 +117,10 @@ function fix_errors() { echo "错误修复完成。" } +# 编辑 .env 文件函数 +function edit_env_file() { + nano nwaku-compose/.env +} + # 主程序开始 main_menu