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

@@ -162,6 +162,11 @@ check_required_vars() {
}
check 6 "All required .env vars are set" check_required_vars
# ---------------------------------------------------------------------------
# Check 6b: .env value format validation (IPs, ports, emails, booleans, etc.)
# ---------------------------------------------------------------------------
check 6b ".env values pass format validation" validate_env
# ---------------------------------------------------------------------------
# Check 7: SSH to Unraid
# ---------------------------------------------------------------------------