bestool-alertd 9.1.1

(Internal) BES tooling: healthcheck daemon
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use bestool_tamanu::server_info::get_or_create_server_id;

use super::CheckContext;
use crate::doctor::check::Check;

pub async fn run(ctx: CheckContext) -> Check {
	// Pass the DB through optionally: an already-provisioned host has the id
	// cached at the standard file path and can answer without a DB, which is
	// what lets the canopy push keep working when postgres is down.
	match get_or_create_server_id(ctx.db.as_deref()).await {
		Ok(id) => {
			Check::pass("server_id", format!("metaServerId: {id}")).with_detail("server_id", id)
		}
		Err(err) => Check::fail("server_id", "lookup failed", err.to_string()),
	}
}