@@ -289,30 +289,16 @@ else
289289 " Run deploy.sh to generate"
290290fi
291291
292- INTEGRITY_CHECK_SCRIPT=" $BAUDBOT_SRC /bin/checks/integrity-status.mjs"
293- INTEGRITY_CHECK_NODE_BIN=" $( bb_resolve_runtime_node_bin " $BAUDBOT_HOME " 2> /dev/null || true) "
294- if [ -z " $INTEGRITY_CHECK_NODE_BIN " ] && command -v node > /dev/null 2>&1 ; then
295- INTEGRITY_CHECK_NODE_BIN=" $( command -v node) "
296- fi
297-
298- if [ -n " $INTEGRITY_CHECK_NODE_BIN " ] && [ -f " $INTEGRITY_CHECK_SCRIPT " ]; then
299- integrity_payload=" $( $INTEGRITY_CHECK_NODE_BIN " $INTEGRITY_CHECK_SCRIPT " " $BAUDBOT_INTEGRITY_STATUS_FILE " 2> /dev/null || true) "
300- else
301- integrity_payload=" "
302- fi
292+ CHECK_NODE_BIN=" $( bb_pick_node_bin " $( bb_resolve_runtime_node_bin " $BAUDBOT_HOME " 2> /dev/null || true) " || true) "
293+ INTEGRITY_CHECK_SCRIPT=" $SCRIPT_DIR /checks/integrity-status.mjs"
294+ integrity_payload=" $( bb_run_node_check_payload " $CHECK_NODE_BIN " " $INTEGRITY_CHECK_SCRIPT " " $BAUDBOT_INTEGRITY_STATUS_FILE " ) "
303295
304296if [ -n " $integrity_payload " ]; then
305- status_exists=" $( printf ' %s' " $integrity_payload " | json_get_string_stdin " exists" 2> /dev/null || true) "
306- status_value=" $( printf ' %s' " $integrity_payload " | json_get_string_stdin " status" 2> /dev/null || true) "
307- status_checked_at=" $( printf ' %s' " $integrity_payload " | json_get_string_stdin " checked_at" 2> /dev/null || true) "
308- status_missing=" $( printf ' %s' " $integrity_payload " | json_get_string_stdin " missing_files" 2> /dev/null || true) "
309- status_mismatches=" $( printf ' %s' " $integrity_payload " | json_get_string_stdin " hash_mismatches" 2> /dev/null || true) "
310-
311- [ -n " $status_exists " ] || status_exists=" 0"
312- [ -n " $status_value " ] || status_value=" unknown"
313- [ -n " $status_checked_at " ] || status_checked_at=" unknown"
314- [ -n " $status_missing " ] || status_missing=" 0"
315- [ -n " $status_mismatches " ] || status_mismatches=" 0"
297+ status_exists=" $( bb_json_field_or_default " $integrity_payload " " exists" " 0" ) "
298+ status_value=" $( bb_json_field_or_default " $integrity_payload " " status" " unknown" ) "
299+ status_checked_at=" $( bb_json_field_or_default " $integrity_payload " " checked_at" " unknown" ) "
300+ status_missing=" $( bb_json_field_or_default " $integrity_payload " " missing_files" " 0" ) "
301+ status_mismatches=" $( bb_json_field_or_default " $integrity_payload " " hash_mismatches" " 0" ) "
316302
317303 if [ " $status_exists " != " 1" ]; then
318304 finding " WARN" " No startup integrity status found" \
@@ -731,18 +717,23 @@ echo ""
731717echo " Bridge Configuration"
732718
733719# Check SLACK_ALLOWED_USERS mode (without reading the actual value)
734- if [ -f " $BAUDBOT_HOME /.config/.env " ] ; then
735- if grep -q ' ^SLACK_ALLOWED_USERS= ' " $BAUDBOT_HOME /.config/.env" 2> /dev/null ; then
736- allowed_count= $( grep ' ^SLACK_ALLOWED_USERS= ' " $BAUDBOT_HOME /.config/.env " 2> /dev/null | cut -d= -f2 | tr ' , ' ' \n ' | grep -c . || echo 0 )
737- if [ " $allowed_count " -gt 0 ] ; then
738- ok " SLACK_ALLOWED_USERS configured ( $allowed_count user(s) )"
739- else
740- finding " WARN " " SLACK_ALLOWED_USERS is empty " \
741- " Bridge will allow all workspace members "
742- fi
743- else
720+ SLACK_ALLOWED_USERS_CHECK_SCRIPT= " $SCRIPT_DIR /checks/slack-allowed-users.mjs "
721+ SLACK_ALLOWED_USERS_ENV_FILE= " $BAUDBOT_HOME /.config/.env"
722+ slack_allowed_users_payload= " $( bb_run_node_check_payload " $CHECK_NODE_BIN " " $SLACK_ALLOWED_USERS_CHECK_SCRIPT " " $SLACK_ALLOWED_USERS_ENV_FILE " ) "
723+
724+ slack_allowed_users_exists= " $( bb_json_field_or_default " $slack_allowed_users_payload " " exists " " 0 " ) "
725+ slack_allowed_users_defined= " $( bb_json_field_or_default " $slack_allowed_users_payload " " defined " " 0 " ) "
726+ slack_allowed_users_count= " $( bb_json_field_or_default " $slack_allowed_users_payload " " count " " 0 " ) "
727+
728+ if [ " $slack_allowed_users_exists " = " 1 " ] ; then
729+ if [ " $slack_allowed_users_defined " != " 1 " ] ; then
744730 finding " WARN" " SLACK_ALLOWED_USERS not set in .env" \
745731 " Bridge will allow all workspace members"
732+ elif [ " $slack_allowed_users_count " -gt 0 ]; then
733+ ok " SLACK_ALLOWED_USERS configured ($slack_allowed_users_count user(s))"
734+ else
735+ finding " WARN" " SLACK_ALLOWED_USERS is empty" \
736+ " Bridge will allow all workspace members"
746737 fi
747738fi
748739echo " "
0 commit comments