Added system/info endpoint, implement tagging

This commit is contained in:
2025-04-13 09:11:52 -04:00
parent c354ea6d78
commit d5bc4cafb8
17 changed files with 143 additions and 22 deletions

31
api/src/system/mod.rs Normal file
View File

@@ -0,0 +1,31 @@
use std::env;
use actix_web::{get, web, HttpResponse};
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]
pub struct SystemInfo {
version: String,
healthy: bool,
}
#[get("/info")]
async fn info() -> HttpResponse {
let mut healthy = true;
let version = match env::var("API_VERSION") {
Ok(v) => v,
Err(_) => {
healthy = false;
String::from("unknown")
}
};
dbg!(&version);
let info = SystemInfo { version, healthy };
HttpResponse::Ok().json(info)
}
pub fn init_routes(config: &mut web::ServiceConfig) {
config.service(web::scope("/system").service(info));
}