Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/utils: allow HTTPHost and WSHost flags precede #2060

Merged
merged 1 commit into from
Dec 14, 2023

Conversation

weiihann
Copy link
Contributor

Description

Fixes #2052.

When users specify the http.addr and ws.addr command line flags, they will overwrite the HTTPHost and WSHost in the config file.

Rationale

As a user, I would assume that specifying flags would overwrite the config files. While this is true for most flags, the behavior is the opposite for http.addr and ws.addr.

Example

config.toml

[Node]
HTTPHost = "127.0.0.1"
WSHost = "127.0.0.1"

Command:

./geth --datadir node --mainnet --http --http.addr 0.0.0.0 --ws --ws.addr 0.0.0.0

Expected output:

...
INFO [12-12|14:17:21.325] HTTP server started                      endpoint=[::]:8545 auth=false prefix= cors= vhosts=localhost
INFO [12-12|14:17:21.326] WebSocket enabled                        url=ws://[::]:8546
...

Actual output:

...
INFO [12-12|14:16:47.073] HTTP server started                      endpoint=127.0.0.1:8545 auth=false prefix= cors= vhosts=localhost
INFO [12-12|14:16:47.073] WebSocket enabled                        url=ws://127.0.0.1:8546
...

Changes

Flags will now overwrite the config file instead.

Copy link

@kaladinlight kaladinlight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick update. This change allows the user to override --http.addr and --ws.addr which accurately reflects upstream geth as seen here:

@zzzckck zzzckck merged commit e4910b9 into bnb-chain:develop Dec 14, 2023
5 checks passed
@weiihann weiihann deleted the fix-cmd branch March 13, 2024 05:36
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.

4 participants