fix(config): 更新服务名称和配置检测逻辑
Test start.ps1 (Windows) / test-windows (push) Has been cancelled

- 将 comfy-server 替换为 easyai-server 在环境配置文件中
- 修改 README.md 中的服务引用名称
- 添加 WS_GATEWAY_LOG_LEVEL 日志级别配置
- 实现 nginx 配置文件自动检测和选择功能
- 更新 https.sh 中的配置文件查找逻辑
This commit is contained in:
2026-04-04 23:01:43 +08:00
parent f33b0850fe
commit 6bb62904e0
6 changed files with 58 additions and 13 deletions
+47 -5
View File
@@ -251,13 +251,56 @@ upsert_domain_for_conf() {
fi
}
detect_existing_proxy_conf() {
local preferred_file=$1
local -a candidates=()
local conf
if [ -n "$preferred_file" ] && [ -f "./$preferred_file" ]; then
echo "$preferred_file"
return 0
fi
while IFS= read -r conf; do
if grep -Eq "^[[:space:]]*server_name[[:space:]]+" "./$conf"; then
candidates+=("$conf")
fi
done < <(ls -1 *.conf 2>/dev/null || true)
if [ "${#candidates[@]}" -eq 0 ]; then
return 1
fi
if [ "${#candidates[@]}" -eq 1 ]; then
echo "${candidates[0]}"
return 0
fi
echo "⚠️ 检测到多个可用配置文件,请选择一个:"
local i
for i in "${!candidates[@]}"; do
printf " %s) %s\n" "$((i + 1))" "${candidates[$i]}"
done
while true; do
read -r -p "请输入序号: " i
if [[ "$i" =~ ^[0-9]+$ ]] && [ "$i" -ge 1 ] && [ "$i" -le "${#candidates[@]}" ]; then
echo "${candidates[$((i - 1))]}"
return 0
fi
echo "❌ 无效序号,请重新输入。"
done
}
echo "🚀 复制当前目录的配置文件到nginx配置文件目录"
# 支持 EASYAI_PROXY_CONF 指定配置文件(如 51easyai.com.conf
CONF_FILE="${EASYAI_PROXY_CONF:-easyai-proxy.conf}"
if [ -f "./$CONF_FILE" ]; then
PREFERRED_CONF_FILE="${EASYAI_PROXY_CONF:-}"
DEFAULT_NEW_CONF_FILE="${EASYAI_PROXY_CONF:-easyai-proxy.conf}"
CONF_FILE=$(detect_existing_proxy_conf "$PREFERRED_CONF_FILE")
if [ -n "$CONF_FILE" ]; then
upsert_domain_for_conf "$CONF_FILE"
else
echo "️ 当前目录未找到配置文件 ./$CONF_FILE"
CONF_FILE="$DEFAULT_NEW_CONF_FILE"
echo "ℹ️ 当前目录未找到可用 nginx 配置文件(*.conf 且包含 server_name"
input_domain=$(prompt_domain)
create_conf_by_template "$input_domain" "$CONF_FILE"
echo "✅ 已根据域名 $input_domain 创建配置文件: ./$CONF_FILE"
@@ -272,12 +315,11 @@ sudo nginx -s stop
echo "🚀 使用certbot 自动配置证书"
# 从 Nginx 配置文件中提取所有域名
CONF_FILE="${EASYAI_PROXY_CONF:-easyai-proxy.conf}"
SERVER_NAME_LINES=$(
if [ -f "/etc/nginx/conf.d/$CONF_FILE" ]; then
grep "server_name" "/etc/nginx/conf.d/$CONF_FILE" 2>/dev/null || true
else
find /etc/nginx/conf.d/ -name "easyai-proxy.conf" -exec grep "server_name" {} \; 2>/dev/null || true
find /etc/nginx/conf.d/ -name "*.conf" -exec grep "server_name" {} \; 2>/dev/null || true
fi
)