Returns the startup banner string. All 11 fields are embedded so callers can assert or display a single value. Intended for both `eprintln!` at server boot and unit tests.
(
pgwire_port: u16,
http_port: u16,
native_port: u16,
cluster_mode: &str,
data_dir: &str,
auth_mode: &str,
)
| 56 | /// All 11 fields are embedded so callers can assert or display a single value. |
| 57 | /// Intended for both `eprintln!` at server boot and unit tests. |
| 58 | pub fn format_banner( |
| 59 | pgwire_port: u16, |
| 60 | http_port: u16, |
| 61 | native_port: u16, |
| 62 | cluster_mode: &str, |
| 63 | data_dir: &str, |
| 64 | auth_mode: &str, |
| 65 | ) -> String { |
| 66 | let pid = std::process::id(); |
| 67 | let host = hostname(); |
| 68 | let mut out = String::with_capacity(512); |
| 69 | out.push('\n'); |
| 70 | out.push_str(&format!(" NodeDB v{VERSION}\n")); |
| 71 | out.push_str(" ─────────────────────────────────────\n"); |
| 72 | out.push_str(&format!(" git_commit : {GIT_COMMIT}\n")); |
| 73 | out.push_str(&format!(" build_date : {BUILD_DATE}\n")); |
| 74 | out.push_str(&format!(" build_profile : {BUILD_PROFILE}\n")); |
| 75 | out.push_str(&format!(" rust_version : {RUST_VERSION}\n")); |
| 76 | out.push_str(&format!(" wire_format_version : {WIRE_FORMAT_VERSION}\n")); |
| 77 | out.push_str(" ─────────────────────────────────────\n"); |
| 78 | out.push_str(&format!(" hostname : {host}\n")); |
| 79 | out.push_str(&format!(" pid : {pid}\n")); |
| 80 | out.push_str(&format!(" pgwire_port : {pgwire_port}\n")); |
| 81 | out.push_str(&format!(" http_port : {http_port}\n")); |
| 82 | out.push_str(&format!(" native_port : {native_port}\n")); |
| 83 | out.push_str(&format!(" cluster_mode : {cluster_mode}\n")); |
| 84 | out.push_str(&format!(" data_dir : {data_dir}\n")); |
| 85 | out.push_str(&format!(" auth_mode : {auth_mode}\n")); |
| 86 | out.push_str("\n Press Ctrl+C to stop.\n"); |
| 87 | out |
| 88 | } |
| 89 | |
| 90 | /// Check if a remote node's wire version is compatible. |
| 91 | /// |