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

Move DAPR GRPC port inside client #54

Merged
merged 11 commits into from
Apr 8, 2024

Conversation

dwhiteddsoft
Copy link
Contributor

Other DAPR SDKs "hide" the obtaining of the GRPC port from the user of client. This change is simply made in that spirit. Changes were:

  • a modification to the client.rs file to obtain the environment variable there and parse
  • a modification to the error.rs to surface errors from this
  • a modification to the pub/sub example to reflect this change

@NickLarsenNZ
Copy link
Contributor

@yaron2 is there anything holding this back?

@NickLarsenNZ
Copy link
Contributor

or is @shubham1172 able to approve?

@NickLarsenNZ
Copy link
Contributor

@yaron2 I see you merged another PR recently. Are you able to take a look at this at the same time?

@@ -17,7 +17,11 @@ impl<T: DaprInterface> Client<T> {
///
/// * `addr` - Address of gRPC server to connect to.
pub async fn connect(addr: String) -> Result<Self, Error> {
Copy link
Member

Choose a reason for hiding this comment

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

Can we also support port: Option<String> that overrides the GRPC port environment variable?
Also, if the environment variable does not exist, it can fallback to a standard default, like 50051.

@@ -17,7 +17,11 @@ impl<T: DaprInterface> Client<T> {
///
/// * `addr` - Address of gRPC server to connect to.
pub async fn connect(addr: String) -> Result<Self, Error> {
Ok(Client(T::connect(addr).await?))
// Get the Dapr port to create a connection
let port: u16 = std::env::var("DAPR_GRPC_PORT")?.parse()?;
Copy link
Member

Choose a reason for hiding this comment

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

It's better to use match and handle the errors here explicitly (we can revert error.rs then). In case of error parsing the environment variable, we can log and fallback to a standard default.

@NickLarsenNZ
Copy link
Contributor

@dwhiteddsoft are you still interested in making the suggested changes?
Or @shubham1172 can we approve and get it in, then your suggestions could be individual issues with implementations coming later?

@shubham1172
Copy link
Member

shubham1172 commented Aug 19, 2023

@dwhiteddsoft are you still interested in making the suggested changes? Or @shubham1172 can we approve and get it in, then your suggestions could be individual issues with implementations coming later?

Yes, those changes can be a follow up IMO.

EDIT: Just realized there are no maintainers/approvers yet so maybe @yaron2/someone from STC can merge it.

@dwhiteddsoft
Copy link
Contributor Author

Just got back from being out. It was so long ago, I thought it wasn't maintained any longer. If I can help in any way, please let me know

@mikeee mikeee added this to the 1.14 milestone Mar 17, 2024
@mikeee mikeee added the P0 label Mar 17, 2024
@mikeee
Copy link
Member

mikeee commented Mar 20, 2024

@dwhiteddsoft Sorry it's been so long since this has been picked up, would you mind if I resolve conflicts on your behalf and get this merged? I'm in agreement that the comments can be picked up at a later date

@dwhiteddsoft
Copy link
Contributor Author

@dwhiteddsoft Sorry it's been so long since this has been picked up, would you mind if I resolve conflicts on your behalf and get this merged? I'm in agreement that the comments can be picked up at a later date

Sure. If there is anything I can or should do please let me know

@dwhiteddsoft dwhiteddsoft requested review from a team as code owners March 20, 2024 18:24
@mikeee
Copy link
Member

mikeee commented Mar 20, 2024

@dwhiteddsoft sorry - just one thing I'll need your help with please, looks like the DCO is failing as the commit wasn't signed off:
https://github.com/dapr/rust-sdk/blob/main/CONTRIBUTING.md#i-didnt-sign-my-commit-now-what

@dwhiteddsoft
Copy link
Contributor Author

@dwhiteddsoft sorry - just one thing I'll need your help with please, looks like the DCO is failing as the commit wasn't signed off: https://github.com/dapr/rust-sdk/blob/main/CONTRIBUTING.md#i-didnt-sign-my-commit-now-what

ack - will work on tonight

@dwhiteddsoft
Copy link
Contributor Author

@dwhiteddsoft sorry - just one thing I'll need your help with please, looks like the DCO is failing as the commit wasn't signed off: https://github.com/dapr/rust-sdk/blob/main/CONTRIBUTING.md#i-didnt-sign-my-commit-now-what

I have done as the docs asked. I have never done this particular step before so I hope I did it correctly.

@mikeee
Copy link
Member

mikeee commented Mar 26, 2024

I can't see a force push to the branch, could you please try again?

@dwhiteddsoft dwhiteddsoft force-pushed the dwhiteddsoft/port-hiding branch from 06eb70e to 982c467 Compare March 26, 2024 15:16
@dwhiteddsoft
Copy link
Contributor Author

I can't see a force push to the branch, could you please try again?

I think I did it correctly. You can reach out to me directly if a call would be easier

@mikeee
Copy link
Member

mikeee commented Mar 26, 2024

I can't see a force push to the branch, could you please try again?

I think I did it correctly. You can reach out to me directly if a call would be easier

https://github.com/dapr/rust-sdk/pull/54/checks?check_run_id=23111766425

This run has a set of instructions (slightly different) to the contributor docs. Give this a shot as it should work too, if the next force push doesn't work feel free to shoot me an email to the one on my profile 👍

@dwhiteddsoft dwhiteddsoft force-pushed the dwhiteddsoft/port-hiding branch from 1e9ac86 to 982c467 Compare March 26, 2024 18:16
@mikeee
Copy link
Member

mikeee commented Mar 26, 2024

I'll set to pass manually 👍

@dwhiteddsoft
Copy link
Contributor Author

I'll set to pass manually 👍

sorry

@mikeee mikeee merged commit 0beb668 into dapr:main Apr 8, 2024
14 checks passed
@dwhiteddsoft dwhiteddsoft deleted the dwhiteddsoft/port-hiding branch April 8, 2024 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants