-
Notifications
You must be signed in to change notification settings - Fork 98
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
runtime/client: add util func to check conn options compatibility with env #594
Conversation
// CheckEnvironmentCompatibility checks if the enviornment is compatible with | ||
// the configured connection options. | ||
func (o *ConnectionOptions) CheckEnvironmentCompatibility() error { | ||
if !o.AllowHTTP { |
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.
Maybe inverse this condition to reduce the levels of nested conditions in the function?
if o.AllowHTTP {
return nil
}
...
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.
i prefer to keep it the current way since it keeps all the logic related to the o.AllowHTTP
field in a single block making it relatively easy for this function to be expanded for when we add more options.
|
||
// CheckEnvironmentCompatibility checks if the enviornment is compatible with | ||
// the configured connection options. | ||
func (o *ConnectionOptions) CheckEnvironmentCompatibility() error { |
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.
Could this function be called Validate()
?
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.
i prefer the current name over Validate()
as imo, the latter means that its checking the configured options are valid which is a bit misleading.
eca38b5
to
6ea71a1
Compare
609fbf9
to
71dd9a0
Compare
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.
LGTM
…h env Add `CheckEnvironmentCompatibility()` to check whether the configured connection options are compatible with the environment, by checking env vars like `HTTP_PROXY` and `HTTPS_PROXY`. Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
Add
CheckEnvironmentCompatibility()
to check whether the configured connection options are compatible with the environment, by checking env vars likeHTTP_PROXY
andHTTPS_PROXY
.