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

Add key authentication #34

Merged
merged 4 commits into from
Jun 25, 2024
Merged

Add key authentication #34

merged 4 commits into from
Jun 25, 2024

Conversation

Marenz
Copy link
Contributor

@Marenz Marenz commented Jun 20, 2024

Update examples to use key and TLS

@github-actions github-actions bot added part:tooling Affects the development tooling (CI, deployment, dependency management, etc.) part:docs Affects the documentation labels Jun 20, 2024
@Marenz
Copy link
Contributor Author

Marenz commented Jun 20, 2024

@Marenz Marenz marked this pull request as ready for review June 20, 2024 09:41
@Marenz Marenz requested a review from a team as a code owner June 20, 2024 09:41
@Marenz Marenz marked this pull request as draft June 20, 2024 09:42
Marenz added 4 commits June 20, 2024 16:10
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>
@Marenz Marenz marked this pull request as ready for review June 20, 2024 14:25
Comment on lines 177 to +197
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)

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?

Copy link
Contributor Author

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

@Marenz Marenz merged commit 95a0f50 into frequenz-floss:v0.x.x Jun 25, 2024
14 checks passed
@Marenz Marenz deleted the key-auth branch June 25, 2024 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
part:docs Affects the documentation part:tooling Affects the development tooling (CI, deployment, dependency management, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants