refactor: extract shared get_public_ip into helpers.sh#1051
Open
mehmetkr-31 wants to merge 1 commit intobase:mainfrom
Open
refactor: extract shared get_public_ip into helpers.sh#1051mehmetkr-31 wants to merge 1 commit intobase:mainfrom
mehmetkr-31 wants to merge 1 commit intobase:mainfrom
Conversation
The get_public_ip() function was duplicated verbatim in both op-node-entrypoint and base-consensus-entrypoint (23 lines each). Any future change to IP detection logic would need to be made in two places, increasing the risk of drift. - Create helpers.sh with a single, documented get_public_ip function. - Replace the inline definitions in op-node-entrypoint and base-consensus-entrypoint with source ./helpers.sh. - Add COPY helpers.sh . to geth, reth, and nethermind Dockerfiles so the helper is available in all final images. No functional change.
Collaborator
🟡 Heimdall Review Status
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Eliminates 23-line duplication of
get_public_ip()acrossop-node-entrypointandbase-consensus-entrypointby moving it into a sharedhelpers.shscript.Problem
The
get_public_ip()bash function was copy-pasted verbatim in two entrypoints. This violates DRY:Solution
helpers.shcontaining a single, documentedget_public_ipimplementation.source ./helpers.shin both entrypoints.COPY helpers.sh .togeth,reth, andnethermindDockerfiles so the helper is present in all final images.Files Changed
helpers.shop-node-entrypointget_public_ip, addsource ./helpers.shbase-consensus-entrypointgeth/DockerfileCOPY helpers.sh .reth/DockerfileCOPY helpers.sh .nethermind/DockerfileCOPY helpers.sh .Verification
get_public_ipis still callable from both entrypoints.helpers.shat repo root, so allCOPYinstructions resolve.Impact
Checklist
source ./helpers.shresolves inside the container (/app).