The deploy names what your .env has that nothing reads

A screenshot of /srv/board/.env showed the whole diagnosis at once: no
CONTENT_TOKEN line, so the app falls back to the admin token and Gitea answers
403 — and two live OAuth credentials for a login flow deleted two phases ago,
sitting there because the deploy never touches .env and never will.

So it names them. The check is the mirror of the one already there: settings in
.env that .env.example no longer documents, found with `comm -13` over the same
two sorted lists. A commented-out line in the example counts as undocumented,
which is how a setting is retired — comment it there, and the next deploy says
it is still on the server. Nothing is rewritten; deleting a line from a file
holding secrets is a decision, not a cleanup.

The "missing" warning also grew consequences. It has been listing CONTENT_TOKEN
as one bare name among several since it was added, which is easy to scroll past;
it now reads "CONTENT_TOKEN — el editor no puede publicar nada en el sitio",
sharing one note_for helper with the empty-value warning below it so the two
cannot drift.

And .env.example stops describing a job GITEA_ADMIN_TOKEN no longer has. It says
what is true now: members have no accounts on the git server, nothing in the
members area calls it, and it CANNOT publish, because Gitea's scopes are per
category and `admin` does not contain `repository`. That sentence is the one
that was missing while the editor sat unable to commit and looking configured.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
This commit is contained in:
Claude 2026-09-30 14:53:00 +00:00
parent 28dd23e444
commit cb034120e0
No known key found for this signature in database
2 changed files with 47 additions and 11 deletions

View File

@ -14,9 +14,18 @@ BOARD_SECRET_KEY=
# database, and ignored afterwards.
BOARD_OWNER=pablo
# Optional. A site-admin token lets admins create Gitea accounts from inside
# the members area. Without it, everything works except account creation, and
# admins add people who already have a Gitea login.
# Optional, and by now almost certainly unnecessary. It could create accounts on
# the git server for new members, back when a member needed one to sign in. They
# do not: a password lives in this app's own database. Nothing in the members
# area calls it any more.
#
# It CANNOT publish. Gitea's token scopes are per category and `admin` does not
# contain `repository`, so a site-admin token gets a 403 from the contents API —
# leaving this filled in and CONTENT_TOKEN empty is how the editor ends up unable
# to commit a single post while looking configured.
#
# Fill in CONTENT_TOKEN below, then revoke this one: it can create and modify
# every account on the instance, and anything that can read this file can use it.
GITEA_ADMIN_TOKEN=
# What the content editor commits with. Members sign in here, on

View File

@ -45,10 +45,22 @@ fi
missing="$(comm -23 \
<(grep -oE '^[A-Z][A-Z0-9_]*=' "$TARGET/.env.example" | sort -u) \
<(grep -oE '^[A-Z][A-Z0-9_]*=' "$TARGET/.env" | sort -u) || true)"
note_for() {
case "${1%=}" in
CONTENT_TOKEN) echo "el editor no puede publicar nada en el sitio" ;;
GITEA_ADMIN_TOKEN) echo "sólo para cuentas del servidor de git; NO publica" ;;
MAIL_HOST|MAIL_PASSWORD) echo "no se envían invitaciones ni recuperaciones" ;;
BOARD_SECRET_KEY) echo "LA APP NO ARRANCA" ;;
*) echo "" ;;
esac
}
if [ -n "$missing" ]; then
echo
echo "!! These settings exist in .env.example but not in your .env:"
echo "$missing" | sed 's/^/ /'
while read -r name; do
printf ' %-20s %s\n' "$name" "$(note_for "$name")"
done <<< "$missing"
echo " Add them to $TARGET/.env and run this again if the feature needs them."
echo
fi
@ -62,13 +74,7 @@ if [ -n "$blank" ]; then
echo
echo "!! These are set to nothing in your .env, so their feature is off:"
while read -r name; do
case "$name" in
GITEA_ADMIN_TOKEN) note="no se pueden crear cuentas ni cambiar contraseñas" ;;
MAIL_HOST|MAIL_PASSWORD) note="no se envían invitaciones ni recuperaciones" ;;
BOARD_SECRET_KEY) note="LA APP NO ARRANCA" ;;
*) note="" ;;
esac
printf ' %-20s %s\n' "$name" "$note"
printf ' %-20s %s\n' "$name" "$(note_for "$name")"
done <<< "$blank"
echo
fi
@ -85,6 +91,27 @@ if [ -z "${BOARD_SKIP_BACKUP:-}" ] && [ -f "${BOARD_DB:-$TARGET/data/board.db}"
bash "$REPO/scripts/backup-board.sh"
fi
# The mirror image of the check above: settings your .env holds that
# .env.example no longer documents. Those are what a feature looks like after it
# is removed — the OAuth client id and secret outlived the login they belonged
# to by two phases, sitting in a file as live credentials for a flow nothing
# calls. A commented-out line in the example counts as undocumented, which is
# how a setting is retired: comment it there, and this names it here.
#
# Named, never touched: this script has never written to .env and does not start
# now. Deleting a line is a decision, and the file may hold something deliberate
# that the repository does not know about.
stale="$(comm -13 \
<(grep -oE '^[A-Z][A-Z0-9_]*=' "$TARGET/.env.example" | sort -u) \
<(grep -oE '^[A-Z][A-Z0-9_]*=' "$TARGET/.env" | sort -u) || true)"
if [ -n "$stale" ]; then
echo
echo "!! Your .env has settings the repository no longer documents:"
echo "$stale" | sed 's/^/ /'
echo " Nothing reads them. If one holds a secret, revoke it and delete the line."
echo
fi
echo "==> Restarting"
cd "$TARGET"
docker compose up -d --force-recreate