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: remove configuration reading from logger initialization #2661

Conversation

henrybarreto
Copy link

  • fix: remove configuration reading from logger initialization

What does this PR do?

It removes the reading for the environment variables from the logger initialization, and prints the message in a more appropriate location.

Why is it important?

Due to the addition of a new init function for the logger initialization and Ryuk disable message, the environment variables were reading as an init function side effect. This caused variables set on the code using the package does not read property.

Due to the addition of a new init function for the logger initialization
and Ryuk disable message, the environment variables were reading as an
init function side effect. This caused variables set on the code using
the `os` package does not read property.

It removes the reading for the environment variables from the logger
initialization, and prints the message in a more appropriate location.
@henrybarreto henrybarreto requested a review from a team as a code owner July 19, 2024 13:07
Copy link

netlify bot commented Jul 19, 2024

Deploy Preview for testcontainers-go ready!

Name Link
🔨 Latest commit 9005c60
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-go/deploys/669a650ecb6b61000874ad6f
😎 Deploy Preview https://deploy-preview-2661--testcontainers-go.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@@ -18,6 +18,17 @@ type TestcontainersConfig struct {
// of the TestcontainersConfig struct
func ReadConfig() TestcontainersConfig {
cfg := config.Read()

if cfg.RyukDisabled {
Copy link
Member

Choose a reason for hiding this comment

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

Will this be printed anytime that a user reads the config? As this method is public API, it would be a bit noisy seeing that message that much.

Copy link
Author

Choose a reason for hiding this comment

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

I, personally, don't see a problem, as this is a kind of warning message. What do you think could be a better approach?

@mdelapenya
Copy link
Member

Relates #2636

@sum-elier
Copy link

@mdelapenya we are affected by this bug and this PR would solve our issues. What's missing for you to approve and merge?

@mdelapenya
Copy link
Member

mdelapenya commented Aug 6, 2024

@mdelapenya we are affected by this bug and this PR would solve our issues. What's missing for you to approve and merge?

@sum-elier I returned from summer holidays yesterday. I'm keeping up with the email, notifications and stuff. Will go back to it asap. OTOH I'd like to discuss more in #2661 (comment), as I'd prefer not printing out that message for each call to config.Read

@stevenh
Copy link
Collaborator

stevenh commented Aug 8, 2024

Didn't spot this and created #2725 which just removes the message totally, as its opt in I would suggest the users knows what they are doing and doesn't want a warning about a conscious decision they have made.

@mdelapenya
Copy link
Member

I think we can close this one, as #2725 has been merged. @henrybarreto could you verify it with the current HEAD in main?

In the meantime I'm closing this one, so please reopen if needed. Thank you!

@mdelapenya mdelapenya closed this Aug 16, 2024
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.

4 participants