From ce560c0dc4e13dcea7a49a8483e0ee1d4fe2b25f Mon Sep 17 00:00:00 2001 From: nutcas3 Date: Sat, 25 Apr 2026 05:58:26 +0300 Subject: [PATCH] feat: Add rate limiting with tower-governor and update health endpoint path to /v1/health - Add tower-governor 0.4.2 dependency to Cargo.toml - Update health check route from /health to /v1/health for API versioning consistency --- apps/charging-engine/Cargo.toml | 1 + apps/charging-engine/src/routes.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/charging-engine/Cargo.toml b/apps/charging-engine/Cargo.toml index 565c8de..2ca5bbd 100644 --- a/apps/charging-engine/Cargo.toml +++ b/apps/charging-engine/Cargo.toml @@ -18,6 +18,7 @@ chrono = { workspace = true } axum = { workspace = true } tower = { workspace = true } tower-http = { workspace = true } +tower-governor = "0.4.2" serde = { workspace = true } serde_json = { workspace = true } tracing = { workspace = true } diff --git a/apps/charging-engine/src/routes.rs b/apps/charging-engine/src/routes.rs index f9330fe..0fddd56 100644 --- a/apps/charging-engine/src/routes.rs +++ b/apps/charging-engine/src/routes.rs @@ -22,7 +22,7 @@ pub fn create_router(state: AppState) -> Router { Router::new() // Public routes (no auth required - for packet-gateway integration) - .route("/health", get(health_check)) + .route("/v1/health", get(health_check)) .route("/v1/credit/:ip/check", post(check_credit)) .route("/v1/credit/:ip/deduct", post(deduct_credit)) .route("/v1/credit/:ip/balance", get(get_balance))