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

Set options with env vars if they're present #261

Merged
merged 3 commits into from
Sep 21, 2022
Merged

Conversation

cartermp
Copy link
Member

This should fix #248

@cartermp cartermp requested review from a team and JamieDanielson September 20, 2022 17:32
@cartermp cartermp changed the title minor code formatting Set options with env vars if they're present Sep 20, 2022
Copy link
Contributor

@MikeGoldsmith MikeGoldsmith 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, thanks @cartermp 👍🏻

I've added a couple of suggestions for handling non-string env vars so we can detect whether the env var was set or not.

Comment on lines 104 to 106
if (!options.EnableLocalVisualizations)
{
options.EnableLocalVisualizations = EnableLocalVisualizations;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure this is correct. If debug was set pragmatically / in settings.json and the env var is set to false, it would still be enabled.

Maybe we could use a bool? to track if the env var was set or not?


if (!options.Debug)
{
options.Debug = Debug;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above, use a bool? to detect if the env var was set.

options.Debug = Debug;
}

if (options.SampleRate == DefaultSampleRate)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this could use a uint? too. We need to detect if the env var was set and use whatever value that is.

@MikeGoldsmith MikeGoldsmith added type: enhancement New feature or request version: bump minor A PR that adds behavior, but is backwards-compatible. labels Sep 21, 2022
@cartermp
Copy link
Member Author

@MikeGoldsmith good catch, yep. I was trying to be clever here. I think what I have now should do it.

@MikeGoldsmith MikeGoldsmith merged commit 1b6e4e8 into main Sep 21, 2022
@MikeGoldsmith MikeGoldsmith deleted the cartermp/env branch September 21, 2022 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request version: bump minor A PR that adds behavior, but is backwards-compatible.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Honeycomb environment variables
2 participants