Skip to content

Commit

Permalink
fix: cross platform compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
parketh committed Oct 23, 2024
1 parent e524495 commit 4f2eb36
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions scripts/l2-explorer/l2-blockscout-set-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ L1_SYSTEM_CONFIG_ADDRESS=$(jq -r '.l1_system_config_address' "$ROLLUP_JSON")
OUTPUT_ORACLE_ADDRESS=$(jq -r '.L2OutputOracleProxy' "$OP_DEPLOYMENTS_JSON_PATH")

# Update .explorer.env file
sed -i "s/^L1_SYSTEM_CONFIG_CONTRACT=.*/L1_SYSTEM_CONFIG_CONTRACT=$L1_SYSTEM_CONFIG_ADDRESS/" "$ENV_FILE"
sed -i "s/^L1_OUTPUT_ORACLE_CONTRACT=.*/L1_OUTPUT_ORACLE_CONTRACT=$OUTPUT_ORACLE_ADDRESS/" "$ENV_FILE"
update_env_var() {
local key="$1"
local value="$2"
local file="$3"
if grep -q "^$key=" "$file"; then
# If the key exists, replace the line
sed -i.bak "s|^$key=.*|$key=$value|" "$file" && rm "${file}.bak"
else
# If the key doesn't exist, append it
echo "$key=$value" >> "$file"
fi
}
update_env_var "L1_SYSTEM_CONFIG_CONTRACT" "$L1_SYSTEM_CONFIG_ADDRESS" "$ENV_FILE"
update_env_var "L1_OUTPUT_ORACLE_CONTRACT" "$OUTPUT_ORACLE_ADDRESS" "$ENV_FILE"

echo "Updated .explorer.env file for Blockscout"

0 comments on commit 4f2eb36

Please sign in to comment.