Skip to content

Commit

Permalink
[CLI] Add advertised ingress address in restate whoami
Browse files Browse the repository at this point in the history
  • Loading branch information
slinkydeveloper committed Feb 7, 2025
1 parent 673c2dc commit ea30a75
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cli/src/clients/admin_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ pub struct AdminClient {
pub(crate) request_timeout: Duration,
pub(crate) admin_api_version: AdminApiVersion,
pub(crate) restate_server_version: Option<String>,
pub(crate) advertised_ingress_address: Option<String>,
}

impl AdminClient {
Expand All @@ -139,6 +140,7 @@ impl AdminClient {
request_timeout: CliContext::get().request_timeout(),
admin_api_version: AdminApiVersion::Unknown,
restate_server_version: None,
advertised_ingress_address: None,
};

if let Ok(envelope) = client.version().await {
Expand Down Expand Up @@ -195,6 +197,8 @@ impl AdminClient {
) {
client.restate_server_version = Some(version_information.version);
client.admin_api_version = admin_api_version;
client.advertised_ingress_address =
version_information.ingress_endpoint.map(|u| u.to_string());
Ok(client)
} else {
bail!("The CLI is not compatible with the Restate server '{}'. Please update the CLI to match the Restate server version '{}'.", client.base_url, version_information.version);
Expand Down
9 changes: 9 additions & 0 deletions cli/src/commands/whoami.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,15 @@ pub async fn run(State(env): State<CliEnv>) {
match client.health().await {
Ok(envelope) if envelope.status_code().is_success() => {
c_success!("Admin Service '{}' is healthy!", client.base_url);
if let Some(advertised_ingress_address) = client.advertised_ingress_address {
let mut table = Table::new();
table.load_preset(comfy_table::presets::NOTHING);
table.add_row(vec![
"Advertised ingress address",
&advertised_ingress_address,
]);
c_println!("{}", table);
}
}
Ok(envelope) => {
c_error!("Admin Service '{}' is unhealthy:", client.base_url);
Expand Down

0 comments on commit ea30a75

Please sign in to comment.