-
Notifications
You must be signed in to change notification settings - Fork 17
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
feat: replace address
and port
with URL for RPC CLI
#81
feat: replace address
and port
with URL for RPC CLI
#81
Conversation
Replaces current `address` and `port` options from the RPC CLI on wafl with a single URL to use a connection string. Fixes: candlecorp#67
Hi @fawadasaurus, I saw your issue on updating address and port for the RPC values with a single connection string and I thought it was a good opportunity to help with wasmflow development. This still in draft as I still have to spin up the RPC server and check the full usage, even though I had the CLI running locally. |
crates/bins/wafl/src/commands/rpc.rs
Outdated
#[clap(short, long)] | ||
pub(crate) url: Url, |
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.
Here I'm missing some validation so Im able to unwrap
with confidence on L50 and L54.
format!("http://{}:{}", opts.connection.address, opts.connection.port), | ||
format!("http://{}:{}", opts.connection.host(), opts.connection.port()), |
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.
My quick solution to allow URLs was to expose previously used address
and port
fields as methods.
Thanks @EstebanBorai. The ideal solution here would completely remove the hardcoded What the referenced issue is asking for is to allow a string to be passed in via the CLI: Currently, it is very rigid with just
In the future we may support many other protocols (eg: web socket) and so we would want to have the command line argument be something like:
|
Awesome! Even better then, so I will replace the current hardcoded instances of What do you think about using the URL crate for this? I think using it is a good idea because we get URL validation OOTB, but I would love to get your POV on using it given that as of today we are using |
It is string right now because I just needed to unblock so it could be used in a docker/container environment :). The default rust URI implementation is part of We have a few other places where |
Of course! I saw your comments following the PR linked in the issue where I got started working on this. Reading the docs and doing some tests here: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=95d20eeace46299ee2e7d5d9234d75d2 I think it would be helpful to use it over |
Replaces current
address
andport
options from the RPC option fromwafl
CLI with a single URL to use a connection string.
Fixes: #67