1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (c) 2026 Super Durable, Inc.
//
// Licensed under the Super Durable Source License 1.0.
// You may not use this file except in compliance with the License.
// See the LICENSE file in the repository root.
//
// SPDX-License-Identifier: LicenseRef-Super-Durable-1.0
use crate::WorkerTarget;
#[derive(Clone, Debug)]
/// Configures how a [`crate::Client`] reaches Dex and identifies application workers.
///
/// [`ClientOptions::new`] connects to `127.0.0.1:8801` over plaintext gRPC and supplies no default
/// worker target. A per-Flow [`crate::FlowConfig`] can override the target.
pub struct ClientOptions {
server_address: String,
worker_target: Option<WorkerTarget>,
}
impl ClientOptions {
/// Creates options with the local Dex server default and no worker target.
pub fn new() -> Self {
Self {
server_address: "127.0.0.1:8801".to_string(),
worker_target: None,
}
}
/// Sets the plaintext gRPC `host:port` used for every client request.
pub fn server_address(mut self, value: impl Into<String>) -> Self {
self.server_address = value.into();
self
}
/// Sets the WorkerService target advertised by newly started Flows.
pub fn worker_target(mut self, value: WorkerTarget) -> Self {
self.worker_target = Some(value);
self
}
pub(crate) fn server_address_value(&self) -> &str {
&self.server_address
}
pub(crate) fn worker_target_value(&self) -> Option<&WorkerTarget> {
self.worker_target.as_ref()
}
}
impl Default for ClientOptions {
fn default() -> Self {
Self::new()
}
}