chore: sync all changes to Gitea
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- Config, docs, scripts, and backup manifests - Submodule refs unchanged (m = modified content in submodules) Made-with: Cursor
This commit is contained in:
38
scripts/validation/validate-config-files.sh
Normal file → Executable file
38
scripts/validation/validate-config-files.sh
Normal file → Executable file
@@ -23,8 +23,8 @@ ERRORS=0
|
||||
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}"
|
||||
# Optional env vars to warn if missing (default empty = no warnings; set VALIDATE_OPTIONAL_ENV for Proxmox API checks)
|
||||
OPTIONAL_ENV="${VALIDATE_OPTIONAL_ENV:-}"
|
||||
|
||||
check_file() {
|
||||
local f="$1"
|
||||
@@ -51,8 +51,8 @@ check_env() {
|
||||
|
||||
if $DRY_RUN; then
|
||||
echo "=== Validation (--dry-run: would check) ==="
|
||||
echo " REQUIRED_FILES: ${REQUIRED_FILES:-<default: config/ip-addresses.conf, .env.example, token-mapping.json, smart-contracts-master.json>}"
|
||||
echo " OPTIONAL_ENV: $OPTIONAL_ENV"
|
||||
echo " REQUIRED_FILES: ${REQUIRED_FILES:-<default: config/ip-addresses.conf, .env.example, token-mapping*.json>}"
|
||||
echo " OPTIONAL_ENV: ${OPTIONAL_ENV:-<empty; set VALIDATE_OPTIONAL_ENV for Proxmox API vars>}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -75,6 +75,8 @@ else
|
||||
ERRORS=$((ERRORS + 1))
|
||||
fi
|
||||
fi
|
||||
elif [[ -f "$PROJECT_ROOT/config/token-mapping-multichain.json" ]] && command -v jq &>/dev/null && jq -e '.pairs | type == "array"' "$PROJECT_ROOT/config/token-mapping-multichain.json" &>/dev/null; then
|
||||
log_ok "Token mapping: using config/token-mapping-multichain.json (relay fallback)"
|
||||
else
|
||||
log_warn "Optional config/token-mapping.json not found (relay uses fallback mapping)"
|
||||
fi
|
||||
@@ -90,11 +92,33 @@ else
|
||||
fi
|
||||
fi
|
||||
[[ -f "$PROJECT_ROOT/config/smart-contracts-master.json" ]] && log_ok "Found: config/smart-contracts-master.json" || true
|
||||
# Token lists (Uniswap format): validate structure if present
|
||||
for list in token-lists/lists/dbis-138.tokenlist.json token-lists/lists/cronos.tokenlist.json token-lists/lists/all-mainnet.tokenlist.json; do
|
||||
if [[ -f "$PROJECT_ROOT/$list" ]] && command -v jq &>/dev/null; then
|
||||
if jq -e '(.tokens | type == "array") and (.tokens | length > 0)' "$PROJECT_ROOT/$list" &>/dev/null; then
|
||||
log_ok "Token list valid: $list"
|
||||
else
|
||||
log_err "Token list invalid or empty: $list"
|
||||
ERRORS=$((ERRORS + 1))
|
||||
fi
|
||||
fi
|
||||
done
|
||||
# DUAL_CHAIN config (explorer deploy source)
|
||||
if [[ -f "$PROJECT_ROOT/explorer-monorepo/backend/api/rest/config/metamask/DUAL_CHAIN_TOKEN_LIST.tokenlist.json" ]] && command -v jq &>/dev/null; then
|
||||
if jq -e '(.tokens | type == "array") and (.tokens | length > 0)' "$PROJECT_ROOT/explorer-monorepo/backend/api/rest/config/metamask/DUAL_CHAIN_TOKEN_LIST.tokenlist.json" &>/dev/null; then
|
||||
log_ok "DUAL_CHAIN_TOKEN_LIST valid"
|
||||
else
|
||||
log_err "DUAL_CHAIN_TOKEN_LIST invalid or empty"
|
||||
ERRORS=$((ERRORS + 1))
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
for v in $OPTIONAL_ENV; do
|
||||
check_env "$v" || true
|
||||
done
|
||||
if [[ -n "$OPTIONAL_ENV" ]]; then
|
||||
for v in $OPTIONAL_ENV; do
|
||||
check_env "$v" || true
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ $ERRORS -gt 0 ]]; then
|
||||
log_err "Validation failed with $ERRORS error(s). Set VALIDATE_REQUIRED_FILES='path1 path2' to require specific files."
|
||||
|
||||
Reference in New Issue
Block a user