Update Waku.sh

This commit is contained in:
sdohuajia 2024-07-27 17:20:44 +08:00 committed by GitHub
parent d849a0a077
commit 07eeb0fd99
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

28
Waku.sh
View File

@ -13,7 +13,8 @@ function main_menu() {
echo "请选择要执行的操作:" echo "请选择要执行的操作:"
echo "1. 安装节点" echo "1. 安装节点"
echo "2. 修复错误" echo "2. 修复错误"
echo "3. 退出" echo "3. 编辑 .env 文件"
echo "4. 退出"
read -rp "请输入操作选项:" choice read -rp "请输入操作选项:" choice
case $choice in case $choice in
@ -24,6 +25,9 @@ function main_menu() {
fix_errors fix_errors
;; ;;
3) 3)
edit_env_file
;;
4)
echo "退出脚本,谢谢使用!" echo "退出脚本,谢谢使用!"
exit 0 exit 0
;; ;;
@ -74,22 +78,7 @@ function install_node() {
cd nwaku-compose cd nwaku-compose
cp .env.example .env cp .env.example .env
# 获取用户输入 echo "请编辑 .env 文件并填写所需的信息:"
read -rp "请输入 ETH_CLIENT_ADDRESSSepolia 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 "nano .env" echo "nano .env"
# 注册节点 # 注册节点
@ -128,5 +117,10 @@ function fix_errors() {
echo "错误修复完成。" echo "错误修复完成。"
} }
# 编辑 .env 文件函数
function edit_env_file() {
nano nwaku-compose/.env
}
# 主程序开始 # 主程序开始
main_menu main_menu