Skip to content

[hermes] Pass Wormhole arguments from command line or env. vars #769

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

Merged
merged 4 commits into from
Apr 19, 2023
Merged

Conversation

thmzlt
Copy link
Contributor

@thmzlt thmzlt commented Apr 18, 2023

Change the p2p module to accept values for the Wormhole parameters.

First commit is just running gofmt (no changes to code).

@vercel
Copy link

vercel bot commented Apr 18, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
example-oracle-amm ⬜️ Ignored (Inspect) Apr 19, 2023 10:58am
xc-admin-frontend ⬜️ Ignored (Inspect) Apr 19, 2023 10:58am

Reisen
Reisen previously requested changes Apr 18, 2023

/// Multiaddresses for Wormhole bootstrap peers (separated by comma).
#[structopt(long, env = "WORMHOLE_BOOTSTRAP_ADDRS")]
wh_bootstrap_addrs: String,
Copy link
Contributor

@Reisen Reisen Apr 18, 2023

Choose a reason for hiding this comment

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

This should be wh_bootstrap-addr: Vec<String> so the parser stays type-safe and is the structop/clap recommended way to do these arguments. The Vec<> way will also help structopt generate an informative --help message unlike the String and allows for:

prog
    --wh-bootstrap-addr <foo> \
    --wh-bootstrap-addr <foo> \
    --wh-bootstrap-addr <foo> \
    --wh-bootstrap-addr <foo>

As there's no real standard on multi-valued single parameters and --foo a,b,c does show up in other programs you can keep it this way if you prefer but I think It's less intuitive and doesn't match what a lot of more modern programs aim for.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good points. The downside is that it makes it harder to pass values using environment variables, but turns out that structopt supports it via https://docs.rs/clap/2.32.0/clap/struct.Arg.html#method.value_delimiter.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh nice, TIL, had not seen this option, and the help doc generated looks good.

@ali-behjati ali-behjati changed the title Pass Wormhole arguments from command line or env. vars [hermes] Pass Wormhole arguments from command line or env. vars Apr 19, 2023
@thmzlt thmzlt requested a review from Reisen April 19, 2023 13:32
@ali-behjati ali-behjati dismissed Reisen’s stale review April 19, 2023 15:47

His changes are addressed

@thmzlt thmzlt merged commit 04b1a21 into main Apr 19, 2023
@thmzlt thmzlt deleted the cfg branch April 19, 2023 20:04
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.

3 participants