- Update dbis_core, cross-chain-pmm-lps, explorer-monorepo, metamask-integration, pr-workspace/chains - Omit embedded publish git dirs and empty placeholders from index Made-with: Cursor
65 lines
2.3 KiB
Bash
65 lines
2.3 KiB
Bash
#!/usr/bin/env bash
|
|
# PMM soak: preserve pool-related and RPC_URL_138 from the caller shell when sourcing
|
|
# scripts/lib/load-project-env.sh (which loads .env and may override these).
|
|
#
|
|
# Usage (immediately before and after sourcing load-project-env.sh):
|
|
# source "${PROJECT_ROOT}/scripts/lib/pmm-soak-dotenv-override.sh"
|
|
# pmm_soak_snapshot_pool_env_for_restore # also snapshots RPC_URL_138 when set
|
|
# source "${PROJECT_ROOT}/scripts/lib/load-project-env.sh"
|
|
# pmm_soak_restore_pool_env_after_dotenv # re-exports CHAIN138_RPC_* from RPC_URL_138 when restored
|
|
#
|
|
# shellcheck shell=bash
|
|
|
|
pmm_soak_snapshot_pool_env_for_restore() {
|
|
_PMM_RSTR_SWAP_VIA_SET=0
|
|
if [[ -n "${CHAIN138_PMM_SOAK_SWAP_VIA+x}" ]]; then
|
|
_PMM_RSTR_SWAP_VIA_SET=1
|
|
_PMM_RSTR_SWAP_VIA_VAL="$CHAIN138_PMM_SOAK_SWAP_VIA"
|
|
fi
|
|
_PMM_RSTR_POOLS_SET=0
|
|
if [[ -n "${PMM_SOAK_POOLS+x}" ]]; then
|
|
_PMM_RSTR_POOLS_SET=1
|
|
_PMM_RSTR_POOLS_VAL="$PMM_SOAK_POOLS"
|
|
fi
|
|
_PMM_RSTR_POOLS_FILE_SET=0
|
|
if [[ -n "${PMM_SOAK_POOLS_FILE+x}" ]]; then
|
|
_PMM_RSTR_POOLS_FILE_SET=1
|
|
_PMM_RSTR_POOLS_FILE_VAL="$PMM_SOAK_POOLS_FILE"
|
|
fi
|
|
_PMM_RSTR_POOL_PRESET_SET=0
|
|
if [[ -n "${PMM_SOAK_POOL_PRESET+x}" ]]; then
|
|
_PMM_RSTR_POOL_PRESET_SET=1
|
|
_PMM_RSTR_POOL_PRESET_VAL="$PMM_SOAK_POOL_PRESET"
|
|
fi
|
|
_PMM_RSTR_RPC_SET=0
|
|
if [[ -n "${RPC_URL_138+x}" ]]; then
|
|
_PMM_RSTR_RPC_SET=1
|
|
_PMM_RSTR_RPC_VAL="$RPC_URL_138"
|
|
fi
|
|
}
|
|
|
|
pmm_soak_restore_pool_env_after_dotenv() {
|
|
if [[ "$_PMM_RSTR_SWAP_VIA_SET" == 1 ]]; then
|
|
export CHAIN138_PMM_SOAK_SWAP_VIA="$_PMM_RSTR_SWAP_VIA_VAL"
|
|
fi
|
|
if [[ "$_PMM_RSTR_POOLS_SET" == 1 ]]; then
|
|
export PMM_SOAK_POOLS="$_PMM_RSTR_POOLS_VAL"
|
|
fi
|
|
if [[ "$_PMM_RSTR_POOLS_FILE_SET" == 1 ]]; then
|
|
export PMM_SOAK_POOLS_FILE="$_PMM_RSTR_POOLS_FILE_VAL"
|
|
fi
|
|
if [[ "$_PMM_RSTR_POOL_PRESET_SET" == 1 ]]; then
|
|
export PMM_SOAK_POOL_PRESET="$_PMM_RSTR_POOL_PRESET_VAL"
|
|
fi
|
|
if [[ "$_PMM_RSTR_RPC_SET" == 1 ]]; then
|
|
export RPC_URL_138="$_PMM_RSTR_RPC_VAL"
|
|
export CHAIN138_RPC_URL="$RPC_URL_138"
|
|
export CHAIN138_RPC="$RPC_URL_138"
|
|
fi
|
|
unset _PMM_RSTR_SWAP_VIA_SET _PMM_RSTR_SWAP_VIA_VAL \
|
|
_PMM_RSTR_POOLS_SET _PMM_RSTR_POOLS_VAL \
|
|
_PMM_RSTR_POOLS_FILE_SET _PMM_RSTR_POOLS_FILE_VAL \
|
|
_PMM_RSTR_POOL_PRESET_SET _PMM_RSTR_POOL_PRESET_VAL \
|
|
_PMM_RSTR_RPC_SET _PMM_RSTR_RPC_VAL 2>/dev/null || true
|
|
}
|