From 498edfc0ff119d3c0e0c941c2b0316e422de8d80 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Fri, 3 May 2024 12:33:56 +0000 Subject: [PATCH] use NodeMetadata struct for writing metadata.json from neon_local --- control_plane/src/pageserver.rs | 13 +++++++------ libs/pageserver_api/src/config.rs | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/control_plane/src/pageserver.rs b/control_plane/src/pageserver.rs index 52accc5890..1a64391306 100644 --- a/control_plane/src/pageserver.rs +++ b/control_plane/src/pageserver.rs @@ -248,12 +248,13 @@ impl PageServerNode { // situation: the metadata is written by some other script. std::fs::write( metadata_path, - serde_json::to_vec(&serde_json::json!({ - "host": "localhost", - "port": self.pg_connection_config.port(), - "http_host": "localhost", - "http_port": http_port, - })) + serde_json::to_vec(&pageserver_api::config::NodeMetadata { + postgres_host: "localhost".to_string(), + postgres_port: self.pg_connection_config.port(), + http_host: "localhost".to_string(), + http_port, + other: HashMap::new(), + }) .unwrap(), ) .expect("Failed to write metadata file"); diff --git a/libs/pageserver_api/src/config.rs b/libs/pageserver_api/src/config.rs index 83cdacf354..c668ad612b 100644 --- a/libs/pageserver_api/src/config.rs +++ b/libs/pageserver_api/src/config.rs @@ -12,7 +12,7 @@ pub const DEFAULT_HTTP_LISTEN_ADDR: &str = formatcp!("127.0.0.1:{DEFAULT_HTTP_LI // itself, it is only used for registering the pageserver with the control // plane and/or storage controller. // -#[derive(serde::Deserialize)] +#[derive(serde::Serialize, serde::Deserialize)] pub struct NodeMetadata { #[serde(rename = "host")] pub postgres_host: String,