feat: include version number in response headers and on application startup (#3045)

This commit is contained in:
Sanchith Hegde
2024-01-05 17:32:36 +05:30
committed by GitHub
parent c8279b110e
commit 252443a50d
6 changed files with 30 additions and 4 deletions

View File

@ -70,7 +70,13 @@ where
pub fn default_response_headers() -> actix_web::middleware::DefaultHeaders {
use actix_web::http::header;
actix_web::middleware::DefaultHeaders::new()
let default_headers_middleware = actix_web::middleware::DefaultHeaders::new();
#[cfg(feature = "vergen")]
let default_headers_middleware =
default_headers_middleware.add(("x-hyperswitch-version", router_env::git_tag!()));
default_headers_middleware
// Max age of 1 year in seconds, equal to `60 * 60 * 24 * 365` seconds.
.add((header::STRICT_TRANSPORT_SECURITY, "max-age=31536000"))
.add((header::VIA, "HyperSwitch"))