fix(gitea): fall back to INITIAL_ADMIN_PASSWORD for gitea-init

Previously both compose files defaulted GITEA_ADMIN_PASSWORD to empty,
and scripts/gitea-init.sh silently skipped admin creation on blank input.
If config.sh failed to propagate the password (e.g. Docs Comments not
enabled, or --admin-password omitted), fresh installs ended up with a
Gitea container running but zero users — and the admin GUI's Gitea setup
wizard had no token to progress.

Changes:
- docker-compose.yml + docker-compose.prod.yml: GITEA_ADMIN_PASSWORD now
  falls back to INITIAL_ADMIN_PASSWORD when unset
- .env.example: declare GITEA_ADMIN_PASSWORD= with explanatory comment so
  users discover the override
- scripts/gitea-init.sh: silent skip becomes a loud WARN so a broken
  config is visible in compose logs

Bunker Admin
This commit is contained in:
2026-04-23 10:54:24 -06:00
parent 94451f9aa0
commit 4ccc433eb9
4 changed files with 11 additions and 5 deletions

View File

@@ -31,7 +31,10 @@ fi
log "Found app.ini at $GITEA_CUSTOM/conf/app.ini"
if [ -z "$GITEA_ADMIN_USER" ] || [ -z "$GITEA_ADMIN_PASSWORD" ] || [ -z "$GITEA_ADMIN_EMAIL" ]; then
log "No GITEA_ADMIN_USER/PASSWORD/EMAIL set — skipping"
log "WARN: GITEA_ADMIN_USER/PASSWORD/EMAIL is blank — admin user will NOT be created."
log "WARN: The Gitea Setup wizard in the admin GUI cannot proceed without this admin."
log "WARN: Fix: set GITEA_ADMIN_PASSWORD (or INITIAL_ADMIN_PASSWORD) in .env, then rerun:"
log "WARN: docker compose up -d gitea-init"
exit 0
fi