add version info

This commit is contained in:
Martin Brodbeck 2025-01-08 14:56:18 +01:00
parent d2ccc665fb
commit 3374110f38

View file

@ -39,6 +39,8 @@ pub struct GetProgress {
timestamp: i64, timestamp: i64,
} }
const VERSION: &str = env!("CARGO_PKG_VERSION");
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
let pg_url: String = env::var("PG_URL") let pg_url: String = env::var("PG_URL")
@ -61,6 +63,7 @@ async fn main() {
.route("/syncs/progress", put(update_progress)) .route("/syncs/progress", put(update_progress))
.route("/syncs/progress/{document}", get(get_progress)) .route("/syncs/progress/{document}", get(get_progress))
.route("/healthcheck", get(healthcheck)) .route("/healthcheck", get(healthcheck))
.route("/version", get(version))
.with_state(db_pool); .with_state(db_pool);
// run it with hyper on localhost:3003 // run it with hyper on localhost:3003
@ -74,6 +77,10 @@ async fn root() -> &'static str {
"KOreader sync server" "KOreader sync server"
} }
async fn version() -> &'static str {
VERSION
}
async fn create_user( async fn create_user(
State(db_pool): State<PgPool>, State(db_pool): State<PgPool>,
Json(payload): Json<User>, Json(payload): Json<User>,