refactor(runtime): wrap rustfs address globals (#4037)

This commit is contained in:
Zhengchao An
2026-06-29 11:18:30 +08:00
committed by GitHub
parent c200dc10d2
commit 9414d645f4
4 changed files with 27 additions and 4 deletions
+10
View File
@@ -76,6 +76,16 @@ pub async fn set_global_addr(addr: &str) {
*GLOBAL_RUSTFS_ADDR.write().await = addr.to_string();
}
/// Get the global RustFS host.
pub async fn get_global_rustfs_host() -> String {
GLOBAL_RUSTFS_HOST.read().await.clone()
}
/// Get the global RustFS address used for gRPC connections.
pub async fn get_global_addr() -> String {
GLOBAL_RUSTFS_ADDR.read().await.clone()
}
/// Set the global root CA certificate for outbound gRPC clients.
/// This certificate is used to validate server TLS certificates.
/// When set to None, clients use the system default root CAs.
+3 -3
View File
@@ -42,7 +42,7 @@ use crate::{
services::tier::tier::TierConfigMgr,
store::ECStore,
};
use rustfs_common::{GLOBAL_LOCAL_NODE_NAME, GLOBAL_RUSTFS_ADDR, GLOBAL_RUSTFS_HOST};
use rustfs_common::GLOBAL_LOCAL_NODE_NAME;
use rustfs_concurrency::WorkloadAdmissionSnapshotProvider;
use rustfs_config::server_config::{Config, get_global_server_config, set_global_server_config};
use rustfs_io_metrics::internode_metrics::global_internode_metrics;
@@ -180,11 +180,11 @@ pub(crate) fn rustfs_port() -> u16 {
}
pub(crate) async fn rustfs_host() -> String {
GLOBAL_RUSTFS_HOST.read().await.clone()
rustfs_common::get_global_rustfs_host().await
}
pub(crate) async fn rustfs_addr() -> String {
GLOBAL_RUSTFS_ADDR.read().await.clone()
rustfs_common::get_global_addr().await
}
pub(crate) fn boot_uptime_secs() -> u64 {