-
Notifications
You must be signed in to change notification settings - Fork 271
[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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
hermes/src/config.rs
Outdated
|
||
/// Multiaddresses for Wormhole bootstrap peers (separated by comma). | ||
#[structopt(long, env = "WORMHOLE_BOOTSTRAP_ADDRS")] | ||
wh_bootstrap_addrs: String, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Change the p2p module to accept values for the Wormhole parameters.
First commit is just running gofmt (no changes to code).