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

fix: avoid overriding user config if possible #236

Merged
merged 8 commits into from
Jul 29, 2022

Conversation

polvalente
Copy link
Contributor

@polvalente polvalente commented Jul 19, 2022

closes #176

@polvalente
Copy link
Contributor Author

polvalente commented Jul 22, 2022

@wingyplus could you review this please? I still need to write tests, but just check if the idea makes sense

@polvalente polvalente marked this pull request as ready for review July 22, 2022 16:21
@polvalente polvalente marked this pull request as draft July 22, 2022 16:21
@wingyplus
Copy link
Contributor

I think it is good to go.

@polvalente polvalente marked this pull request as ready for review July 22, 2022 23:11
{:dialyxir, "~> 1.1", only: [:dev, :test], runtime: false}
{:ex_doc, "~> 0.28.0", only: :dev},
{:inch_ex, "~> 2.0.0", only: [:dev, :test]},
{:dialyxir, "~> 1.1.0", only: [:dev, :test], runtime: false}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why we change the version constraint?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are only for the lib itself (only prod deps are propagated to the client libs).

Therefore, I made this more strict because I always prefer to be as strict as possible with dependencies

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

else
Map.put(open_opts, :transport_opts, transport_opts)
end
tls_opts = Keyword.merge(@default_transport_opts ++ ssl, transport_opts)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just quick check from mobile.

which ssl configuration (via cred vs via transport_opts) is higher priority?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Via transport options

There's a test that shows that

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to document GRPC.Stub.connect about this behaviour? Because the library encourage user to use GRPC.Credential to set ssl credential but now user can set it via adapter option when calling GRPC.Stub.connect.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so. This is a per-adapter specification

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can decide to not let some overrides take place, though.

Although I wouldn't invest too much energy in the Gun adapter since we're planning on moving on to Mint

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I prefer the way it's currently coded, in which the opts values have precedence. Could you point to where in the docs it encourages the SSL values to be used? I don't think we'll have to change those other than adding a "opts can override this" warning

Copy link
Contributor

@wingyplus wingyplus Jul 29, 2022

Choose a reason for hiding this comment

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

Here it is https://github.com/elixir-grpc/grpc/blob/master/lib/grpc/credential.ex#L3. Maybe it is only my understandable. 🙇‍♂️

Agree that if we can warning the opts can be override.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll improve on that :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done :) I'm merging this, but let me know if things are still unclear

Copy link
Contributor

Choose a reason for hiding this comment

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

That’s totally clear :)

@wingyplus
Copy link
Contributor

Overall, LGTM. :)

@polvalente polvalente merged commit 1e0598b into master Jul 29, 2022
@polvalente polvalente deleted the pv-fix/allow-user-tcp-opts-to-persist branch July 29, 2022 12:33
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.

Unable to specify gun tcp_opts field when using gun v2
2 participants