update
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
script_dir=$(cd "$(dirname "$0")"; pwd)
|
||||
config_dir="$script_dir/../conf"
|
||||
source $script_dir/utils/jq_util.sh
|
||||
|
||||
# 输入dest值
|
||||
old_dest=$(jq -r '.inbounds[0].streamSettings.realitySettings.dest' "$config_dir/config.json")
|
||||
read -p "请输入新的dest地址[当前地址: $old_dest]: " dest
|
||||
|
||||
# 如果输入dest为空
|
||||
if [[ -z "$dest" ]]; then
|
||||
echo "输入dest为空,退出脚本"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
domain=$(echo "$dest" | awk -F ':' '{print $1}')
|
||||
|
||||
|
||||
echo "正在修改配置文件..."
|
||||
|
||||
# 修改配置文件的dest
|
||||
modify_json_file "$config_dir/config.json" ".inbounds[0].streamSettings.realitySettings.dest" "$dest"
|
||||
|
||||
# 修改配置文件的serverNames
|
||||
modify_json_file "$config_dir/config.json" ".inbounds[0].streamSettings.realitySettings.serverNames" "[\"$domain\"]"
|
||||
|
||||
echo "配置文件修改成功!"
|
||||
echo "新的dest地址为: $dest"
|
||||
echo "新的serverNames数组为: [\"$domain\"]"
|
||||
|
||||
|
||||
read -p "是否要重启容器? (y/N): " restart_choice
|
||||
if [[ "$restart_choice" =~ ^[Yy]$ ]]; then
|
||||
echo "正在重启容器..."
|
||||
docker-compose -f "$script_dir/../docker-compose.yml" down
|
||||
docker-compose -f "$script_dir/../docker-compose.yml" up -d
|
||||
else
|
||||
echo "已跳过重启,请手动重启容器使配置生效"
|
||||
fi
|
||||
Reference in New Issue
Block a user