diff --git a/bin/create_config.sh b/bin/create_config.sh index ccaca32..f444ef4 100644 --- a/bin/create_config.sh +++ b/bin/create_config.sh @@ -72,6 +72,12 @@ create_self_tls_config() { create_config(){ local script_dir=$(cd "$(dirname "$0")"; pwd) + + # 如果配置文件不存在, 创建空白配置文件 + if [ ! -e "$script_dir/../config.json" ]; then + touch "$script_dir/../config.json" + fi + local config_password=$(jq -r '.auth.password' "$script_dir/../config.json") if [ -s "$script_dir/../config.json" ] && [ "$config_password" != "你的密码" ]; then local regenerate diff --git a/bin/run.sh b/bin/run.sh index 7d2fb03..e56ed0b 100644 --- a/bin/run.sh +++ b/bin/run.sh @@ -14,6 +14,9 @@ run() { check_bash_installed # 如果配置没有创建 + if [ ! -e "$config_dir/../config.json" ]; then + touch "$config_dir/../config.json" + fi local password=$(jq -r '.auth.password' "$config_dir/config.json") if [ ! -s "$config_dir/config.json" ] || [ "$password" = "你的密码" ]; then bash "$script_dir/create_config.sh" # 创建配置