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

feat: Implemented Go SDK env var handling #975

Merged
merged 1 commit into from
Feb 10, 2022
Merged

Conversation

jeremytchang
Copy link
Collaborator

Also added unit tests for it that will leave existing environment variables undisturbed. (Will store env vars before test and restore env vars after test)

Also added unit tests for it that will leave existing environment variables undisturbed. (Will store env vars before test and restore env vars after test)
@github-actions
Copy link
Contributor

github-actions bot commented Feb 8, 2022

Go Tests

  2 files    2 suites   24s ⏱️
30 tests 30 ✔️ 0 💤 0 ❌
60 runs  60 ✔️ 0 💤 0 ❌

Results for commit 5830729.

Copy link
Contributor

@jkaster jkaster left a comment

Choose a reason for hiding this comment

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

Looks good. Do you want to update the GoLook readme for this now, or in another PR?

}
if v, present := os.LookupEnv(verifySslEnvKey); present {
s := strings.ToLower(v)
settings.VerifySsl = s == "true" || s == "t" || s == "1" || s == "y" || s == "yes"
Copy link
Contributor

Choose a reason for hiding this comment

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

fwiw other SDKs have either an isBool() or defaultBool() type of helper function. In this case, I think we want to default settings.VerifySSL to true

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh good catch! I will fix.

Copy link
Collaborator Author

@jeremytchang jeremytchang Feb 10, 2022

Choose a reason for hiding this comment

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

I just reread the spec. My logic is correct. It already has verifySSL default to true at line 49. Only if the env variable is set does it change.

true, t, yes, y, or 1 (case insensitive) to enable SSL verification. Any other value is treated as false. Defaults to true if not set.

@jeremytchang jeremytchang merged commit 571a817 into main Feb 10, 2022
@jeremytchang jeremytchang deleted the jc/go_env_var branch February 10, 2022 18:33
@github-actions

This comment has been minimized.

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.

2 participants