Use proper secret injected method for supervisor
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
This commit is contained in:
@@ -151,9 +151,22 @@ async fn deliver_one(
|
|||||||
// Build supervisor method and params from Message
|
// Build supervisor method and params from Message
|
||||||
let method = msg.message.clone();
|
let method = msg.message.clone();
|
||||||
let params = build_params(&msg)?;
|
let params = build_params(&msg)?;
|
||||||
|
|
||||||
// Send
|
// Send
|
||||||
let out_id = client.call(&method, params).await?;
|
// If this is a job.run and we have a secret configured on the client,
|
||||||
|
// prefer the typed wrapper that injects the secret into inner supervisor params.
|
||||||
|
let out_id = if method == "job.run" {
|
||||||
|
if let Some(j) = msg.job.first() {
|
||||||
|
let jv = job_to_json(j)?;
|
||||||
|
// This uses SupervisorClient::job_run, which sets {"secret": "...", "job": <job>}
|
||||||
|
client.job_run(jv).await?
|
||||||
|
} else {
|
||||||
|
// Fallback: no embedded job, use the generic call
|
||||||
|
client.call(&method, params).await?
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
client.call(&method, params).await?
|
||||||
|
};
|
||||||
|
|
||||||
// Store transport id and initial Sent status
|
// Store transport id and initial Sent status
|
||||||
let _ = service
|
let _ = service
|
||||||
|
Reference in New Issue
Block a user