Update generate_config.sh

This commit is contained in:
wnlen
2026-03-20 17:43:42 +08:00
parent 828a706978
commit 7af2937685

View File

@ -149,14 +149,26 @@ main() {
fi
# 片段订阅:这里先保留模板拼接逻辑
if [ ! -s "$CONF_DIR/template_config.yaml" ]; then
echo "[ERROR] missing template_config.yaml" >&2
TEMPLATE_FILE=""
if [ -s "$CONF_DIR/template_config.yaml" ]; then
TEMPLATE_FILE="$CONF_DIR/template_config.yaml"
elif [ -s "$TEMP_DIR/templete_config.yaml" ]; then
TEMPLATE_FILE="$TEMP_DIR/templete_config.yaml"
elif [ -s "$CONF_DIR/templete_config.yaml" ]; then
TEMPLATE_FILE="$CONF_DIR/templete_config.yaml"
elif [ -s "$PROJECT_DIR/temp/templete_config.yaml" ]; then
TEMPLATE_FILE="$PROJECT_DIR/temp/templete_config.yaml"
fi
if [ -z "$TEMPLATE_FILE" ]; then
echo "[ERROR] missing template config file (template_config.yaml / templete_config.yaml)" >&2
write_state "failed" "missing_template" "none"
exit 1
fi
sed -n '/^proxies:/,$p' "$TEMP_CONVERTED" > "$TEMP_DIR/proxy.txt"
cat "$CONF_DIR/template_config.yaml" > "$RUNTIME_CONFIG"
cat "$TEMPLATE_FILE" > "$RUNTIME_CONFIG"
cat "$TEMP_DIR/proxy.txt" >> "$RUNTIME_CONFIG"
sed -i "s/CLASH_HTTP_PORT_PLACEHOLDER/${CLASH_HTTP_PORT}/g" "$RUNTIME_CONFIG"