Skip to content

Commit 8634a57

Browse files
committed
bridge: migrate protected slack-bridge path to /opt release
1 parent b118fa7 commit 8634a57

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

pi/skills/control-agent/startup-cleanup.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ if [ -r "$RUNTIME_NODE_HELPER" ]; then
2222
source "$RUNTIME_NODE_HELPER"
2323
fi
2424

25+
NODE_BIN_DIR="${NODE_BIN_DIR:-$HOME/opt/node/bin}"
26+
if command -v bb_resolve_runtime_node_bin_dir >/dev/null 2>&1; then
27+
NODE_BIN_DIR="$(bb_resolve_runtime_node_bin_dir "$HOME")"
28+
fi
29+
30+
BAUDBOT_CURRENT_LINK="${BAUDBOT_CURRENT_LINK:-/opt/baudbot/current}"
31+
BAUDBOT_ENV_FILE="${BAUDBOT_ENV_FILE:-$HOME/.config/.env}"
32+
2533
SOCKET_DIR="$HOME/.pi/session-control"
2634

2735
if [ $# -eq 0 ]; then
@@ -79,7 +87,7 @@ fi
7987

8088
BRIDGE_LOG_DIR="$HOME/.pi/agent/logs"
8189
BRIDGE_LOG_FILE="$BRIDGE_LOG_DIR/slack-bridge.log"
82-
BRIDGE_DIR="/opt/baudbot/current/slack-bridge"
90+
BRIDGE_DIR="$BAUDBOT_CURRENT_LINK/slack-bridge"
8391
BRIDGE_TMUX_SESSION="slack-bridge"
8492

8593
mkdir -p "$BRIDGE_LOG_DIR"
@@ -147,10 +155,6 @@ fi
147155
# The tmux session stays alive independently of this script (same pattern as
148156
# sentry-agent). If the bridge crashes, the loop restarts it after 5 seconds.
149157
echo "Starting slack-bridge ($BRIDGE_SCRIPT) via tmux..."
150-
NODE_BIN_DIR="${NODE_BIN_DIR:-$HOME/opt/node/bin}"
151-
if command -v bb_resolve_runtime_node_bin_dir >/dev/null 2>&1; then
152-
NODE_BIN_DIR="$(bb_resolve_runtime_node_bin_dir "$HOME")"
153-
fi
154158
if [ ! -d "$NODE_BIN_DIR" ]; then
155159
# Fallback: resolve versioned node dir
156160
NODE_BIN_DIR="$(echo "$HOME"/opt/node-v*-linux-x64/bin | awk '{print $1}')"
@@ -164,7 +168,7 @@ tmux new-session -d -s "$BRIDGE_TMUX_SESSION" "\
164168
while true; do \
165169
echo \"[\$(date -Is)] bridge: starting $BRIDGE_SCRIPT\" >> $BRIDGE_LOG_FILE; \
166170
for v in \$(env | grep ^SLACK_BROKER_ | cut -d= -f1 || true); do unset \$v; done; \
167-
set -a; source \$HOME/.config/.env; set +a; \
171+
set -a; source $BAUDBOT_ENV_FILE; set +a; \
168172
node $BRIDGE_SCRIPT >> $BRIDGE_LOG_FILE 2>&1; \
169173
exit_code=\$?; \
170174
echo \"[\$(date -Is)] bridge: exited with code \$exit_code, restarting in 5s\" >> $BRIDGE_LOG_FILE; \

0 commit comments

Comments
 (0)