diff --git a/network-poc/native-node/src/main.rs b/network-poc/native-node/src/main.rs index 09ba82b..ffc7154 100644 --- a/network-poc/native-node/src/main.rs +++ b/network-poc/native-node/src/main.rs @@ -222,6 +222,8 @@ fn build_auth_message(allocated_gb: u32) -> String { v }).collect(); + let api_key = std::env::var("NODE_API_KEY").unwrap_or_default(); + let mut msg = json!({ "type": "auth", "status": "agent_ready", @@ -231,6 +233,10 @@ fn build_auth_message(allocated_gb: u32) -> String { "system": sys, }); + if !api_key.is_empty() { + msg.as_object_mut().unwrap().insert("api_key".to_string(), json!(api_key)); + } + if !gpu_json.is_empty() { msg.as_object_mut().unwrap().insert("gpus".to_string(), json!(gpu_json)); }