Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands - CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround - CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check - NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere - MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates - LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference Co-authored-by: Cursor <cursoragent@cursor.com>
67 lines
1.7 KiB
Bash
67 lines
1.7 KiB
Bash
#!/usr/bin/env bash
|
|
# Validate required config files and optional env vars before deployment/scripts
|
|
# Recommendation: docs/10-best-practices/IMPLEMENTATION_CHECKLIST.md (Configuration validation)
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
|
|
log_info() { echo "[INFO] $1"; }
|
|
log_ok() { echo "[OK] $1"; }
|
|
log_warn() { echo "[WARN] $1"; }
|
|
log_err() { echo "[ERROR] $1"; }
|
|
|
|
ERRORS=0
|
|
|
|
# Required config paths (adjust per project)
|
|
REQUIRED_FILES="${VALIDATE_REQUIRED_FILES:-}"
|
|
# Example: REQUIRED_FILES="/path/to/config.toml /path/to/.env"
|
|
|
|
# Optional env vars to warn if missing
|
|
OPTIONAL_ENV="${VALIDATE_OPTIONAL_ENV:-PROXMOX_TOKEN_VALUE PROXMOX_HOST}"
|
|
|
|
check_file() {
|
|
local f="$1"
|
|
if [[ -f "$f" ]]; then
|
|
log_ok "Found: $f"
|
|
return 0
|
|
else
|
|
log_err "Missing required file: $f"
|
|
ERRORS=$((ERRORS + 1))
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
check_env() {
|
|
local name="$1"
|
|
if [[ -z "${!name:-}" ]]; then
|
|
log_warn "Optional env not set: $name"
|
|
return 1
|
|
else
|
|
log_ok "Env set: $name"
|
|
return 0
|
|
fi
|
|
}
|
|
|
|
if [[ -n "$REQUIRED_FILES" ]]; then
|
|
for f in $REQUIRED_FILES; do
|
|
check_file "$f"
|
|
done
|
|
else
|
|
# Default: check common locations
|
|
[[ -d "$PROJECT_ROOT/config" ]] && check_file "$PROJECT_ROOT/config/ip-addresses.conf" || true
|
|
[[ -f "$PROJECT_ROOT/.env.example" ]] && log_ok ".env.example present (copy to .env and fill)" || true
|
|
fi
|
|
|
|
for v in $OPTIONAL_ENV; do
|
|
check_env "$v" || true
|
|
done
|
|
|
|
if [[ $ERRORS -gt 0 ]]; then
|
|
log_err "Validation failed with $ERRORS error(s). Set VALIDATE_REQUIRED_FILES='path1 path2' to require specific files."
|
|
exit 1
|
|
fi
|
|
log_ok "Validation passed."
|
|
exit 0
|