feat: add service config templates and extraction script

Former-commit-id: 1de24b7eb79676d1aba9d799a58c5a753290cf52
This commit is contained in:
反编译工作区
2026-05-01 19:38:01 +08:00
parent 3175b7074b
commit 8b15445328
2433 changed files with 8322164 additions and 1604 deletions
@@ -2,14 +2,23 @@
# 与当前目录下 application.properties 同路径启动 V2maven 构建)包。
# 默认优先系统 JDK 8;若只有 JDK11+ 会自动附加 --add-opens。
# ELEVATOR_USE_ENV_JAVA=1 ./run.sh 使用当前 JAVA_HOME(如 Conda)。
# 发布包内脚本与 JAR、properties 均位于发布根目录(与 cw-elevator-application-V1.0.0.20211103 布局一致)。
set -euo pipefail
cd "$(dirname "$0")"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=../common-java.sh
source "$(cd "$(dirname "$0")" && pwd)/../common-java.sh"
source "${SCRIPT_DIR}/../common-java.sh"
cd "$SCRIPT_DIR"
JAR="cw-elevator-application-2.0.0.jar"
if [[ ! -f "$JAR" ]]; then
echo "缺少 $JAR,请在 deploy 目录执行: ./sync-jars.sh" >&2
JAR=""
for candidate in $(ls -1t cw-elevator-application-*.jar 2>/dev/null || true); do
if [[ "${candidate}" == *.jar.original ]]; then
continue
fi
JAR="${candidate}"
break
done
if [[ -z "${JAR}" || ! -f "${JAR}" ]]; then
echo "缺少 cw-elevator-application-*.jar,请在 deploy 目录执行: ./sync-jars.sh" >&2
exit 1
fi
@@ -24,16 +33,6 @@ while IFS= read -r line; do
[[ -n "$line" ]] && OPEN_FLAGS+=("$line")
done < <(_jdk8_open_flags "$JAVA")
# 同 v1:由 redis-override.properties 合并出 SPRING_APPLICATION_JSON
if ! command -v python3 >/dev/null 2>&1; then
echo "需要 python3deploy/merge-redis-json.sh)。请安装 python3。" >&2
exit 1
fi
MERGE="$(cd "$(dirname "$0")" && pwd)/../merge-redis-json.sh"
if [[ ! -x "$MERGE" ]]; then
chmod +x "$MERGE" 2>/dev/null || true
fi
export SPRING_APPLICATION_JSON="$("$MERGE" "$PWD/redis-override.properties")"
# 强制走 Consul:不再注入本地 application*.properties / redis-override.properties
# shellcheck disable=SC2086
exec "$JAVA" "${OPEN_FLAGS[@]}" ${ELEVATOR_JAVA_OPTS:-} -jar "$JAR" \
--spring.config.location=file:./application.properties,file:./application-access-control.properties,file:./redis-override.properties
exec "$JAVA" "${OPEN_FLAGS[@]}" ${ELEVATOR_JAVA_OPTS:-} -jar "$JAR"