Skip to content

Fix/env override handling#83

Merged
coincashew merged 2 commits intocoincashew:mainfrom
Jor-Tech:fix/env-override-handling
Apr 30, 2025
Merged

Fix/env override handling#83
coincashew merged 2 commits intocoincashew:mainfrom
Jor-Tech:fix/env-override-handling

Conversation

@Jor-Tech
Copy link
Copy Markdown
Contributor

@Jor-Tech Jor-Tech commented Apr 30, 2025

Description

This PR improves the handling of environment variable overrides in the node checker script and ensures consistent URL formatting.

Changes

  1. Environment Variable Override Improvements:

    • Modified environment variable override logic to handle individual variable overrides
    • Added default values for unset variables
    • Improved error handling for missing variables
    • Now supports partial overrides of either IP or port for both endpoints
  2. URL Format Consistency:

    • Added http:// prefix to EL_RPC_ENDPOINT default value
    • Added http:// prefix to overridden EL_RPC_ENDPOINT value
    • Ensures consistent URL formatting across both endpoints

Testing

The changes allow for more flexible configuration in .env.overrides:

Environment Variable Overrides

  • Can override just CL_REST_PORT while keeping default localhost
  • Can override just CL_IP_ADDRESS while keeping default port
  • Can override just EL_RPC_PORT while keeping default localhost
  • Can override just EL_IP_ADDRESS while keeping default port
  • Can override both variables for either endpoint
  • Can override none of the variables

URL Format

  • Both endpoints now consistently use http:// prefix
  • Default values:
    • API_BN_ENDPOINT="http://localhost:5052"
    • EL_RPC_ENDPOINT="http://localhost:8545"
  • Overridden values maintain the http:// prefix

Example .env.overrides Configurations

# Override just the consensus layer port
CL_REST_PORT=3500

# Override just the execution layer IP
EL_IP_ADDRESS=192.168.1.100

# Override both consensus layer variables
CL_IP_ADDRESS=192.168.1.100
CL_REST_PORT=3500

# Override both execution layer variables
EL_IP_ADDRESS=192.168.1.100
EL_RPC_PORT=8545

@coincashew
Copy link
Copy Markdown
Owner

👍 awesome

@coincashew coincashew merged commit 9f89ddc into coincashew:main Apr 30, 2025
1 check passed
@Jor-Tech Jor-Tech deleted the fix/env-override-handling branch April 30, 2025 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants