Skip to content

Commit 176af79

Browse files
authored
fix seed replacement in worker (#471)
1 parent d0a17e7 commit 176af79

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

crates/worker/src/docker/service.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,11 @@ impl DockerService {
194194
let cmd = match payload.cmd {
195195
Some(cmd_vec) => {
196196
cmd_vec.into_iter().map(|arg| {
197-
// Replace ${SOCKET_PATH}
198-
arg.replace("${SOCKET_PATH}", &task_bridge_socket_path)
197+
let mut processed_arg = arg.replace("${SOCKET_PATH}", &task_bridge_socket_path);
198+
if let Some(seed) = p2p_seed {
199+
processed_arg = processed_arg.replace("${WORKER_P2P_SEED}", &seed.to_string());
200+
}
201+
processed_arg
199202
}).collect()
200203
}
201204
None => vec!["sleep".to_string(), "infinity".to_string()],
@@ -205,17 +208,17 @@ impl DockerService {
205208
if let Some(env) = &payload.env_vars {
206209
// Clone env vars and replace ${SOCKET_PATH} in values
207210
for (key, value) in env.iter() {
208-
let processed_value = value.replace("${SOCKET_PATH}", &task_bridge_socket_path);
211+
let mut processed_value = value.replace("${SOCKET_PATH}", &task_bridge_socket_path);
212+
if let Some(seed) = p2p_seed {
213+
processed_value = processed_value.replace("${WORKER_P2P_SEED}", &seed.to_string());
214+
}
209215
env_vars.insert(key.clone(), processed_value);
210216
}
211217
}
212218

213219
env_vars.insert("NODE_ADDRESS".to_string(), node_address);
214220
env_vars.insert("PRIME_MONITOR__SOCKET__PATH".to_string(), task_bridge_socket_path.to_string());
215221
env_vars.insert("PRIME_TASK_ID".to_string(), payload.id.to_string());
216-
if let Some(p2p_seed) = p2p_seed {
217-
env_vars.insert("IROH_SEED".to_string(), p2p_seed.to_string());
218-
}
219222

220223
let mut volumes = vec![
221224
(

0 commit comments

Comments
 (0)