Skip to content

fix api token initialization #722

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

famarting
Copy link
Contributor

Description

I noticed that currently, if an API token is provided, it is not used to create the grpc connection, it is only used in subsequent requests after the connection is stablished.

This PR fixes that forcing the API token env var to be read when initializing the authToken holder

Issue reference

Please reference the issue this PR will close: #[issue number]

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

Signed-off-by: Fabian Martinez <[email protected]>
@famarting famarting requested review from a team as code owners April 22, 2025 08:20
Copy link

codecov bot commented Apr 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.96%. Comparing base (6c59092) to head (26da11e).
Report is 24 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #722      +/-   ##
==========================================
- Coverage   62.52%   60.96%   -1.57%     
==========================================
  Files          56       58       +2     
  Lines        4139     4350     +211     
==========================================
+ Hits         2588     2652      +64     
- Misses       1425     1568     +143     
- Partials      126      130       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@mikeee mikeee left a comment

Choose a reason for hiding this comment

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

Minor nit but looks good to me!

func newAuthToken() *authToken {
apiToken := os.Getenv(apiTokenEnvVarName)
if apiToken != "" {
logger.Println("client uses API token")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
logger.Println("client uses API token")
logger.Println("API Token loaded from the environment variable")

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