-
Notifications
You must be signed in to change notification settings - Fork 139
multi app token workflow (started from allow to create clients with different dapr-api-token ) #856
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
5c7fc54
43b0b68
46c78ec
aa3ef52
b092daa
0f6edfa
828544a
f7547a6
9b78558
2fa1ff2
465209c
bca1f9c
cd7f34c
ebcdf1b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -141,6 +141,7 @@ def __init__( | |||||
| ] = None, | ||||||
| max_grpc_message_length: Optional[int] = None, | ||||||
| retry_policy: Optional[RetryPolicy] = None, | ||||||
| api_token: Optional[str] = None, | ||||||
| ): | ||||||
| """Connects to Dapr Runtime and initialize gRPC client stub. | ||||||
|
|
||||||
|
|
@@ -152,8 +153,13 @@ def __init__( | |||||
| StreamStreamClientInterceptor, optional): gRPC interceptors. | ||||||
| max_grpc_message_length (int, optional): The maximum grpc send and receive | ||||||
| message length in bytes. | ||||||
| api_token (str, optional): Dapr API token for authentication. If not provided, | ||||||
| falls back to DAPR_API_TOKEN environment variable. | ||||||
| """ | ||||||
| DaprHealth.wait_until_ready() | ||||||
| self._api_token = api_token | ||||||
|
||||||
| self._api_token = api_token | |
| api_token = api_token if api_token is not None else settings.DAPR_API_TOKEN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, makes sense, I'll make changes in a commit as it covers more than just this line
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,6 +52,7 @@ def __init__( | |
| host: Optional[str] = None, | ||
| port: Optional[str] = None, | ||
| logger_options: Optional[LoggerOptions] = None, | ||
| api_token: Optional[str] = None, | ||
| ): | ||
| address = getAddress(host, port) | ||
|
|
||
|
|
@@ -61,10 +62,12 @@ def __init__( | |
| raise DaprInternalError(f'{error}') from error | ||
|
|
||
| self._logger = Logger('DaprWorkflowClient', logger_options) | ||
| self._api_token = api_token | ||
|
||
|
|
||
| metadata = tuple() | ||
| if settings.DAPR_API_TOKEN: | ||
| metadata = ((DAPR_API_TOKEN_HEADER, settings.DAPR_API_TOKEN),) | ||
| token = self._api_token if self._api_token is not None else settings.DAPR_API_TOKEN | ||
| if token: | ||
| metadata = ((DAPR_API_TOKEN_HEADER, token),) | ||
| options = self._logger.get_options() | ||
| self.__obj = client.TaskHubGrpcClient( | ||
| host_address=uri.endpoint, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.