Add server and client build versions

This commit is contained in:
2024-09-01 14:55:51 -07:00
parent fdaff70231
commit 1f393f1c7f
17 changed files with 342 additions and 13 deletions

View File

@@ -183,6 +183,7 @@ async fn graphql_request(
request.execute(schema.inner()).await
}
#[rocket::main]
async fn main() -> Result<(), Box<dyn Error>> {
glog::new()
@@ -193,6 +194,8 @@ async fn main() -> Result<(), Box<dyn Error>> {
..Default::default()
})
.unwrap();
build_info::build_info!(fn bi);
info!("Build Info: {}", shared::build_version(bi));
let allowed_origins = AllowedOrigins::all();
let cors = rocket_cors::CorsOptions {
allowed_origins,

View File

@@ -229,6 +229,10 @@ struct SearchCursor {
pub struct QueryRoot;
#[Object]
impl QueryRoot {
async fn version<'ctx>(&self, _ctx: &Context<'ctx>) -> Result<String, Error> {
build_info::build_info!(fn bi);
Ok(shared::build_version(bi))
}
async fn count<'ctx>(&self, ctx: &Context<'ctx>, query: String) -> Result<usize, Error> {
let nm = ctx.data_unchecked::<Notmuch>();
let pool = ctx.data_unchecked::<PgPool>();