Standardize deployment env and deployer handling
This commit is contained in:
@@ -14,7 +14,7 @@ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
cd "$PROJECT_ROOT"
|
||||
|
||||
if [[ -f "$SCRIPT_DIR/../lib/deployment/dotenv.sh" ]]; then
|
||||
# shellcheck disable=SC1090
|
||||
# shellcheck disable=SC1090
|
||||
source "$SCRIPT_DIR/../lib/deployment/dotenv.sh"
|
||||
load_deployment_env --repo-root "$PROJECT_ROOT"
|
||||
elif [[ -f "$PROJECT_ROOT/.env" ]]; then
|
||||
@@ -49,13 +49,9 @@ if [[ -n "${DEPLOYER_ADDRESS:-}" ]]; then
|
||||
DEPLOYER="${DEPLOYER_ADDRESS}"
|
||||
[[ "$DEPLOYER" != 0x* ]] && DEPLOYER="0x$DEPLOYER"
|
||||
else
|
||||
if [[ -z "${PRIVATE_KEY:-}" ]]; then
|
||||
echo "Error: Set PRIVATE_KEY in .env or DEPLOYER_ADDRESS for read-only check" >&2
|
||||
exit 1
|
||||
fi
|
||||
DEPLOYER=$(cast wallet address "$PRIVATE_KEY" 2>/dev/null || true)
|
||||
DEPLOYER="$(derive_deployer_address 2>/dev/null || true)"
|
||||
if [[ -z "$DEPLOYER" ]]; then
|
||||
echo "Error: Could not derive deployer from PRIVATE_KEY (is 'cast' available?)" >&2
|
||||
echo "Error: Set PRIVATE_KEY or DEPLOYER_ADDRESS for read-only check." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user