sync: update from private repo (cae291d)
Some checks failed
CI / build-and-test (push) Has been cancelled
Some checks failed
CI / build-and-test (push) Has been cancelled
This commit is contained in:
parent
138401ce1b
commit
a126fe8d18
@ -52,6 +52,29 @@ if [[ -f "$PROJECT_DIR/.env" ]]; then
|
||||
unset _line _kv _key _val _envfile_set _q _esc
|
||||
fi
|
||||
|
||||
# Best-effort read of `server.port` from config.yaml (top-level `server:` block).
|
||||
# Only used for the display / lsof fallback below; the app reads config itself.
|
||||
read_config_port() {
|
||||
local cfg="$PROJECT_DIR/config.yaml"
|
||||
[[ -f "$cfg" ]] || return 1
|
||||
awk '
|
||||
/^[^[:space:]#]/ { in_server = ($1 == "server:") }
|
||||
in_server && $1 == "port:" { gsub(/[^0-9]/, "", $2); if ($2 != "") { print $2; exit } }
|
||||
' "$cfg"
|
||||
}
|
||||
|
||||
# Port precedence mirrors the app: explicit PORT (shell env or .env) > server.port
|
||||
# in config.yaml > built-in default (9876).
|
||||
#
|
||||
# Only forward PORT to the app when the operator set it explicitly. Otherwise we
|
||||
# must NOT inject it, or it would override `server.port` from config.yaml (the
|
||||
# app resolves PORT env > server.port > default). PORT below is for the startup
|
||||
# message / lsof stray-kill / status only; it tracks the effective value so those
|
||||
# stay accurate without changing what the app binds.
|
||||
PORT_EXPLICIT="${PORT:-}"
|
||||
if [[ -z "$PORT_EXPLICIT" ]]; then
|
||||
PORT="$(read_config_port || true)"
|
||||
fi
|
||||
PORT="${PORT:-9876}"
|
||||
|
||||
cd "$PROJECT_DIR"
|
||||
@ -105,7 +128,13 @@ do_start() {
|
||||
# To launch as a gateway: `AAO_MODE=gateway scripts/server.sh start` and
|
||||
# set `gateway.listen_port` in config.yaml (default 4000). dist/index.js
|
||||
# is preserved as a worker-mode shim for legacy paths.
|
||||
PORT="$PORT" AAO_MODE="${AAO_MODE:-worker}" nohup node dist/main.js >> "$LOG_FILE" 2>&1 &
|
||||
# Forward PORT only when explicitly set; otherwise let the app resolve
|
||||
# server.port from config.yaml (passing PORT here would override it).
|
||||
if [[ -n "$PORT_EXPLICIT" ]]; then
|
||||
PORT="$PORT_EXPLICIT" AAO_MODE="${AAO_MODE:-worker}" nohup node dist/main.js >> "$LOG_FILE" 2>&1 &
|
||||
else
|
||||
AAO_MODE="${AAO_MODE:-worker}" nohup node dist/main.js >> "$LOG_FILE" 2>&1 &
|
||||
fi
|
||||
local pid=$!
|
||||
echo "$pid" > "$PID_FILE"
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user