Native-node lähettää NODE_API_KEY auth-viestissä hubille
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) <noreply@anthropic.com>
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user