mirror of
https://github.com/hpd840321/starRiverProperty.git
synced 2026-06-10 08:50:29 +08:00
Initial commit: reorganized source tree
- backend/: 13 Maven modules (cw-elevator-application, cloudwalk-cloud, intelligent-cwoscomponent, ninca-crk, etc.) - frontend/: 4 Vue projects (elevator-front, cwos-portal, alarm-front, front_acs) + decompiled + scripts - scripts/: build, test-env, tools (Docker Compose, service templates, API parity) - docs/: AGENTS.md, superpowers specs, architecture docs - .gitignore: standard Java/Maven exclusions Moved from legacy maven-*/ root layout to backend/ organized structure.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
# 读取 redis-override.properties,输出一行 SPRING_APPLICATION_JSON(紧凑 JSON)。
|
||||
# 若环境变量 SPRING_REDIS_PASSWORD 已设置(含空字符串),则覆盖文件中的 spring.redis.password。
|
||||
# 用法: export SPRING_APPLICATION_JSON="$(./merge-redis-json.sh /path/to/redis-override.properties)"
|
||||
set -euo pipefail
|
||||
PROP="${1:?用法: merge-redis-json.sh <redis-override.properties>}"
|
||||
if [[ ! -f "$PROP" ]]; then
|
||||
echo "找不到文件: $PROP" >&2
|
||||
exit 1
|
||||
fi
|
||||
python3 - "$PROP" <<'PY'
|
||||
import json, os, pathlib, re, sys
|
||||
|
||||
prop = pathlib.Path(sys.argv[1])
|
||||
lines = prop.read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def get(key):
|
||||
pat = r"^" + re.escape(key) + r"\s*=\s*(.*?)\s*$"
|
||||
m = re.search(pat, lines, re.MULTILINE)
|
||||
return m.group(1).strip() if m else ""
|
||||
|
||||
|
||||
host = get("spring.redis.host") or "127.0.0.1"
|
||||
port_raw = get("spring.redis.port") or "6379"
|
||||
try:
|
||||
port = int(port_raw)
|
||||
except ValueError:
|
||||
port = 6379
|
||||
|
||||
if "SPRING_REDIS_PASSWORD" in os.environ:
|
||||
pwd = os.environ["SPRING_REDIS_PASSWORD"]
|
||||
else:
|
||||
pwd = get("spring.redis.password")
|
||||
|
||||
payload = {"spring": {"redis": {"host": host, "port": port, "password": pwd}}}
|
||||
print(json.dumps(payload, separators=(",", ":")))
|
||||
PY
|
||||
Reference in New Issue
Block a user