Files
wekan/snap-src/bin/wekan-problems
T
Lauri Ojansivu d69c83f949 snap wekan.problems: load snap settings so ROOT_URL / LDAP checks read the real config.
Reported: after `snap set wekan root-url="https://..."`, `snap run wekan.problems`
still showed "ROOT_URL is not set". Cause: the wrapper exec'd wekan-problems.mjs
WITHOUT the snap settings in its environment, so `process.env.ROOT_URL` (and
LDAP_ENABLE) were empty in that process and the login-page checks always reported
ROOT_URL unset — regardless of the snap setting. The DB-backed checks (broken cards,
migrations/repairs in progress) were correct; only the env-derived ones were wrong.

Source `$SNAP/bin/wekan-read-settings` (echo suppressed) before exec so ROOT_URL /
LDAP_ENABLE / DATABASE etc. are exported and the login-page checks see the same
configuration WeKan runs with.

Thanks to xet7 !
2026-07-23 12:03:16 +03:00

28 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# wekan-problems — print the Admin Panel / Problems "Status" overview as text, so an
# admin with server (snap) access can see problems, migrations and repairs WITHOUT
# Admin Panel access. Runs wekan-problems.mjs with the bundled Node.js and the WeKan
# bundle's node_modules on NODE_PATH so the `mongodb` driver resolves (same pattern
# as db-eval).
#
# Usage:
# snap run wekan.problems # full overview
# snap run wekan.problems migrations # only migrations/repairs in progress
# snap run wekan.problems login # only the "Must be logged in" checks
# snap run wekan.problems broken-cards # only the broken-cards count
# snap run wekan.problems cpu # machine CPU load / core count
# snap run wekan.problems help
# Load the snap settings so the login-page checks see the SAME configuration WeKan
# runs with — ROOT_URL, LDAP_ENABLE, DATABASE, etc. Without this the command reads an
# empty process.env and always reported ROOT_URL as "not set" even after
# `snap set wekan root-url=...` (wekan/wekan feedback). wekan-read-settings exports
# each key; suppress its per-key echo so it doesn't pollute the report.
if [ -r "$SNAP/bin/wekan-read-settings" ]; then
# shellcheck disable=SC1091
. "$SNAP/bin/wekan-read-settings" >/dev/null 2>&1 || true
fi
exec env NODE_PATH="$SNAP/programs/server/node_modules" \
"$SNAP/bin/node" "$SNAP/bin/wekan-problems.mjs" "$@"