Skip to content

Commit de1c15e

Browse files
committed
Add support for key-based authentication
Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent 50fa7af commit de1c15e

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ dependencies = [
4242
"frequenz-sdk == 1.0.0rc601",
4343
"frequenz-channels >= 1.0.1, < 2.0.0",
4444
"frequenz-api-dispatch >= 0.13.0, < 0.14",
45-
"frequenz-client-dispatch >= 0.2.0, < 0.3.0",
45+
"frequenz-client-dispatch >= 0.4.0, < 0.5.0",
4646
"frequenz-client-base >= 0.3.0, < 0.5.0",
4747
"frequenz-client-common >= 0.1.0, < 0.3.0",
4848
]

src/frequenz/dispatch/_dispatcher.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,20 +175,26 @@ async def run():
175175
"""
176176

177177
def __init__(
178-
self, microgrid_id: int, grpc_channel: grpc.aio.Channel, svc_addr: str
178+
self,
179+
*,
180+
microgrid_id: int,
181+
grpc_channel: grpc.aio.Channel,
182+
svc_addr: str,
183+
key: str,
179184
):
180185
"""Initialize the dispatcher.
181186
182187
Args:
183188
microgrid_id: The microgrid id.
184189
grpc_channel: The gRPC channel.
185190
svc_addr: The service address.
191+
key: The key to access the service.
186192
"""
187193
self._running_state_channel = Broadcast[Dispatch](name="running_state_change")
188194
self._lifecycle_events_channel = Broadcast[DispatchEvent](
189195
name="lifecycle_events"
190196
)
191-
self._client = Client(grpc_channel, svc_addr)
197+
self._client = Client(grpc_channel=grpc_channel, svc_addr=svc_addr, key=key)
192198
self._actor = DispatchingActor(
193199
microgrid_id,
194200
self._client,

0 commit comments

Comments
 (0)