feat: extract .env validators to common.sh and add validate_env()

Move 10 validation functions from configure_env.sh to lib/common.sh as
shared utilities. Define variable-to-validator mapping using parallel
arrays (bash 3.2 compatible). validate_env() checks all ~50 .env
variables against their expected format and reports all failures at once.

Wired into preflight.sh (Check 6b) and bitwarden_to_env.sh (post-restore).
configure_env.sh now sources validators from common.sh instead of
defining its own copies.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
S
2026-02-28 22:08:01 -05:00
parent 743f1281e6
commit 0e0aeda658
7 changed files with 192 additions and 45 deletions

View File

@@ -65,7 +65,7 @@ Each phase has three scripts: the main script, a `_post_check.sh` that independe
gitea-migration/
├── .env.example # Configuration template (copy to .env)
├── runners.conf.example # Runner definitions template
├── lib/common.sh # Shared functions (535 lines)
├── lib/common.sh # Shared functions + .env validators
├── setup/
│ ├── configure_env.sh # Interactive .env wizard (~50 prompts)
│ ├── macbook.sh # Local prerequisites (brew packages)
@@ -87,7 +87,7 @@ gitea-migration/
├── backup/
│ ├── backup_primary.sh # Gitea dump, SCP to Fedora
│ └── restore_to_primary.sh # Restore dump to Unraid
├── preflight.sh # 24 pre-flight validation checks
├── preflight.sh # 25 pre-flight validation checks
├── run_all.sh # Full pipeline orchestration
├── teardown_all.sh # Reverse teardown (9 to 1)
├── manage_runner.sh # Dynamic runner add/remove/list