-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add key authentication #34
Conversation
Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
def __init__( | ||
self, microgrid_id: int, grpc_channel: grpc.aio.Channel, svc_addr: str | ||
self, | ||
*, | ||
microgrid_id: int, | ||
grpc_channel: grpc.aio.Channel, | ||
svc_addr: str, | ||
key: str, | ||
): | ||
"""Initialize the dispatcher. | ||
|
||
Args: | ||
microgrid_id: The microgrid id. | ||
grpc_channel: The gRPC channel. | ||
svc_addr: The service address. | ||
key: The key to access the service. | ||
""" | ||
self._running_state_channel = Broadcast[Dispatch](name="running_state_change") | ||
self._lifecycle_events_channel = Broadcast[DispatchEvent]( | ||
name="lifecycle_events" | ||
) | ||
self._client = Client(grpc_channel, svc_addr) | ||
self._client = Client(grpc_channel=grpc_channel, svc_addr=svc_addr, key=key) |
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.
Looks good to me.
Just side note that 3 out of 4 arguments to Dispatcher constructor are really arguments to Client constructor.
And they are just passed to Client. And every description for these arguments is repeated in Client.
Maybe we could have single struct like ClientArgs in the future?
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.
That could work, though we want to change to the base-client where it will do this job for us
Update examples to use key and TLS