Skip to content

Conversation

@filintod
Copy link
Contributor

Description

Please explain the changes you've made

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

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

…iginal env var DAPR_API_TOKEN if found

Signed-off-by: Filinto Duran <[email protected]>
Signed-off-by: Filinto Duran <[email protected]>
@filintod filintod requested review from a team as code owners October 23, 2025 22:27
Copy link
Member

@acroca acroca left a comment

Choose a reason for hiding this comment

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

Also add more information in the PR description 🙏

# -*- coding: utf-8 -*-

"""
Copyright 2024 The Dapr Authors
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
Copyright 2024 The Dapr Authors
Copyright 2025 The Dapr Authors

falls back to DAPR_API_TOKEN environment variable.
"""
DaprHealth.wait_until_ready()
self._api_token = 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.

Why don't set api_token to default to settings.DAPR_API_TOKEN, and use it throughout this init function?

Suggested change
self._api_token = api_token
api_token = api_token if api_token is not None else settings.DAPR_API_TOKEN

"""
self._client = DaprHttpClient(message_serializer, timeout, headers_callback, retry_policy)
self._client = DaprHttpClient(
message_serializer, timeout, headers_callback, retry_policy, api_token=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.

I like kv arguments, but for consistency...

Suggested change
message_serializer, timeout, headers_callback, retry_policy, api_token=api_token
message_serializer, timeout, headers_callback, retry_policy, api_token

class DaprHealth:
@staticmethod
def wait_until_ready():
def wait_until_ready(api_token: str = None):
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
def wait_until_ready(api_token: str = None):
def wait_until_ready(api_token: Optional[str] = None):

raise DaprInternalError(f'{error}') from error

self._logger = Logger('DaprWorkflowClient', logger_options)
self._api_token = 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.

Does this need to go to _api_token? Can't we just use api_token directly? I don't think it's used outside of this function

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