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

@@ -12,6 +12,7 @@ anyhow = "1.0.79"
async-graphql = { version = "6.0.11", features = ["log"] }
async-graphql-rocket = "6.0.11"
async-trait = "0.1.81"
build-info = "0.0.38"
css-inline = "0.13.0"
glog = "0.1.0"
html-escape = "0.2.13"
@@ -34,3 +35,6 @@ thiserror = "1.0.37"
tokio = "1.26.0"
url = "2.5.2"
urlencoding = "2.1.3"
[build-dependencies]
build-info-build = "0.0.38"

5
server/build.rs Normal file
View File

@@ -0,0 +1,5 @@
fn main() {
// Calling `build_info_build::build_script` collects all data and makes it available to `build_info::build_info!`
// and `build_info::format!` in the main program.
build_info_build::build_script();
}

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>();