重构代码, 改为函数形式
This commit is contained in:
parent
dd80d3601b
commit
0c884a87fc
@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
update_docker_images(){
|
||||||
script_dir=$(cd "$(dirname "$0")"; pwd) # 脚本文件绝对路径
|
script_dir=$(cd "$(dirname "$0")"; pwd) # 脚本文件绝对路径
|
||||||
docker_compose_file="$script_dir/../docker-compose.yml" # docker-compose.yml文件路径
|
docker_compose_file="$script_dir/../docker-compose.yml" # docker-compose.yml文件路径
|
||||||
|
|
||||||
@ -20,3 +22,6 @@ docker image prune -f
|
|||||||
|
|
||||||
echo "正在启动容器.."
|
echo "正在启动容器.."
|
||||||
docker-compose -f $docker_compose_file up -d
|
docker-compose -f $docker_compose_file up -d
|
||||||
|
}
|
||||||
|
|
||||||
|
update_docker_images
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
update_key(){
|
||||||
|
|
||||||
script_dir=$(cd "$(dirname "$0")"; pwd) # 脚本文件绝对路径
|
script_dir=$(cd "$(dirname "$0")"; pwd) # 脚本文件绝对路径
|
||||||
config_dir="$script_dir/../conf"
|
config_dir="$script_dir/../conf"
|
||||||
source $script_dir/utils/jq_util.sh
|
source $script_dir/utils/jq_util.sh
|
||||||
@ -14,3 +16,8 @@ private_key=$(grep "Private" $config_dir/key.txt | awk -F ': ' '{print $2}')
|
|||||||
modify_json_file "$config_dir/config.json" ".inbounds[0].streamSettings.realitySettings.privateKey" "$private_key"
|
modify_json_file "$config_dir/config.json" ".inbounds[0].streamSettings.realitySettings.privateKey" "$private_key"
|
||||||
|
|
||||||
echo "生成和设置密钥成功."
|
echo "生成和设置密钥成功."
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
update_key
|
||||||
@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
update_uuid(){
|
||||||
|
|
||||||
script_dir=$(cd "$(dirname "$0")"; pwd) # 脚本文件绝对路径
|
script_dir=$(cd "$(dirname "$0")"; pwd) # 脚本文件绝对路径
|
||||||
config_dir="$script_dir/../conf"
|
config_dir="$script_dir/../conf"
|
||||||
|
|
||||||
@ -12,3 +14,6 @@ uuid=$(docker run --rm teddysun/xray:latest xray uuid)
|
|||||||
modify_json_file "$config_dir/config.json" ".inbounds[0].settings.clients[0].id" "$uuid"
|
modify_json_file "$config_dir/config.json" ".inbounds[0].settings.clients[0].id" "$uuid"
|
||||||
|
|
||||||
echo "设置UUID成功."
|
echo "设置UUID成功."
|
||||||
|
}
|
||||||
|
|
||||||
|
update_uuid
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user