Standardize deployment env and deployer handling
This commit is contained in:
@@ -28,23 +28,13 @@ elif [[ -n "${REPO_ROOT:-}" && -f "$REPO_ROOT/.env" ]]; then
|
||||
set +a
|
||||
fi
|
||||
|
||||
# Load environment variables
|
||||
if [ ! -f .env ]; then
|
||||
log_error "Error: .env file not found"
|
||||
echo "Please create .env file with required variables"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source .env
|
||||
|
||||
# Check required variables
|
||||
if [ -z "$PRIVATE_KEY" ]; then
|
||||
log_error "Error: PRIVATE_KEY not set in .env"
|
||||
if ! require_private_key_env; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
RPC_URL="${RPC_URL:-${RPC_URL_138:-${CHAIN138_RPC_URL:-}}}"
|
||||
if [ -z "$RPC_URL" ]; then
|
||||
log_error "Error: RPC_URL not set in .env"
|
||||
log_error "ERROR: Chain 138 RPC not available. Set RPC_URL, RPC_URL_138, or CHAIN138_RPC_URL."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -62,7 +52,7 @@ log_success "✅ RPC endpoint is accessible"
|
||||
update_env() {
|
||||
local key=$1
|
||||
local value=$2
|
||||
if grep -q "^${key}=" .env; then
|
||||
if grep -q "^${key}=" .env 2>/dev/null; then
|
||||
sed -i "s|^${key}=.*|${key}=${value}|" .env
|
||||
else
|
||||
echo "${key}=${value}" >> .env
|
||||
@@ -240,7 +230,7 @@ ORACLE_HEARTBEAT=${ORACLE_HEARTBEAT:-"60"}
|
||||
ORACLE_DEVIATION_THRESHOLD=${ORACLE_DEVIATION_THRESHOLD:-"50"}
|
||||
|
||||
# Get deployer address
|
||||
DEPLOYER_ADDRESS=$(cast wallet address --private-key "$PRIVATE_KEY" 2>/dev/null || echo "")
|
||||
DEPLOYER_ADDRESS="$(derive_deployer_address || true)"
|
||||
|
||||
if [ -z "$DEPLOYER_ADDRESS" ]; then
|
||||
log_warn "Warning: Could not get deployer address. Using script default"
|
||||
|
||||
Reference in New Issue
Block a user