diff --git a/src/config.rs b/src/config.rs index 4999fc2..65779fc 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,9 +1,12 @@ use anyhow::Result; use serde::{Deserialize, Serialize}; +use crate::global::IP_INFO; + #[derive(Debug, Clone, Serialize, Deserialize)] pub struct HostConfig { pub brain_url: String, + #[serde(default = "retrieve_node_ip")] pub host_ip_address: String, pub operator_wallet: String, pub max_cores_per_app: u32, @@ -25,6 +28,10 @@ fn default_reserved_no_of_port() -> u32 { 16 } +fn retrieve_node_ip() -> String { + IP_INFO.ip.clone() +} + impl HostConfig { pub fn load_from_disk(path: &str) -> Result { let content = std::fs::read_to_string(path)?; diff --git a/src/grpc.rs b/src/grpc.rs index faaa0ef..5b626a6 100644 --- a/src/grpc.rs +++ b/src/grpc.rs @@ -31,7 +31,7 @@ pub async fn register_node(config: &crate::HostConfig) -> Result { - // TODO: update host resources to brain self.send_node_resources().await; - info!("Succesfully started VM {uuid}"); + info!("Succesfully started App {uuid}"); let res = NewAppRes { uuid, status: "success".to_string(),