From 3374110f389cd105a8c5c9c29b2a118b74b33c3a Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Wed, 8 Jan 2025 14:56:18 +0100 Subject: [PATCH] add version info --- src/main.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.rs b/src/main.rs index 99373e6..dadab76 100644 --- a/src/main.rs +++ b/src/main.rs @@ -39,6 +39,8 @@ pub struct GetProgress { timestamp: i64, } +const VERSION: &str = env!("CARGO_PKG_VERSION"); + #[tokio::main] async fn main() { let pg_url: String = env::var("PG_URL") @@ -61,6 +63,7 @@ async fn main() { .route("/syncs/progress", put(update_progress)) .route("/syncs/progress/{document}", get(get_progress)) .route("/healthcheck", get(healthcheck)) + .route("/version", get(version)) .with_state(db_pool); // run it with hyper on localhost:3003 @@ -74,6 +77,10 @@ async fn root() -> &'static str { "KOreader sync server" } +async fn version() -> &'static str { + VERSION +} + async fn create_user( State(db_pool): State, Json(payload): Json,