From 4f18377a3b2fd068c8b2401b2e517b0b467c1c4e Mon Sep 17 00:00:00 2001 From: Jaakko Vanhala Date: Thu, 9 Apr 2026 15:39:48 +0300 Subject: [PATCH] =?UTF-8?q?Native-node=20l=C3=A4hett=C3=A4=C3=A4=20NODE=5F?= =?UTF-8?q?API=5FKEY=20auth-viestiss=C3=A4=20hubille?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Luetaan NODE_API_KEY-ympäristömuuttuja ja lisätään api_key-kenttä auth-viestiin. Hub tarkistaa avaimen ja hylkää solmun jos se ei täsmää. Käyttö: NODE_API_KEY=kpn_sk_abc123 HUB_URL=ws://hub:3000/ws cargo run Co-Authored-By: Claude Opus 4.6 (1M context) --- network-poc/native-node/src/main.rs | 6 ++++++ 1 file changed, 6 insertions(+) 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)); }