fix: fix: disinto init fails on re-run — admin password not persisted (#158) #163
No reviewers
Labels
No labels
action
backlog
blocked
bug-report
in-progress
prediction/actioned
prediction/dismissed
prediction/unreviewed
priority
tech-debt
underspecified
vision
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#163
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/issue-158"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #158
Changes
AI Review
Summary\n\nThis PR fixes issue #158: on a re-run of
disinto init, the admin user already exists in Forgejo but a fresh random password was generated each time — causing basic-auth to fail for everything downstream. The fix:\n1. Reads a persistedFORGE_ADMIN_PASSfrom.envbefore generating a new one.\n2. Persists the password to.envafter first creation.\n3. On re-run (user already exists), resets the Forgejo password to the persisted value to guarantee consistency.\n4. Moves_FORGE_ADMIN_PASS=$admin_passoutside the if/else so it's always set — previously it was never set on re-runs, which would have broken Woodpecker OAuth2 token generation (#779).\n\n### Checklist\n\n- Logic: Flow is correct.grep … 2>/dev/nullsafely handles a missing.envfile.${admin_pass:-}correctly triggers fresh-generation when the file exists but the key is absent.\n- sed safety: Password format isadmin-[a-zA-Z0-9]{20}, no characters that could escape the|delimiter insed -i.\n- _FORGE_ADMIN_PASS placement: Correctly moved out of the creation branch — this is a meaningful secondary fix.\n- Edge case (no .env, user already exists): The new password generated in this scenario is applied viachange-passwordbut not persisted. Functionally fine for the run (the variable is set), though subsequent runs will repeat the reset. This is an unlikely pre-existing edge case and out of scope for this fix.\n- No secrets leaked: Password is written to.envviaprintf, never echoed or logged.\n- No external actions: All operations are local forge calls — no vault dispatch needed.Verdict
APPROVE — Correctly fixes idempotent re-run by persisting and reloading the admin password; also fixes the pre-existing bug where _FORGE_ADMIN_PASS was never set on re-runs.
Reviewed at
aa17336| AGENTS.mdAI Review: APPROVE — Correctly fixes idempotent re-run by persisting and reloading the admin password; also fixes the pre-existing bug where _FORGE_ADMIN_PASS was never set on re-runs.