Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
chore: improve tower layers (#636)
Sean Aye36c82e19ff5f
diff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lockindex d4ab4f427a..264fd79ddf 100644--- a/rust/cloud-storage/Cargo.lock+++ b/rust/cloud-storage/Cargo.lock@@ -133,6 +133,21 @@ dependencies = ["equator",]+[[package]]+name = "alloc-no-stdlib"+version = "2.0.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3"++[[package]]+name = "alloc-stdlib"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece"+dependencies = [+ "alloc-no-stdlib",+]+[[package]]name = "allocator-api2"version = "0.2.21"@@ -295,6 +310,7 @@ version = "0.4.18"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "df895a515f70646414f4b45c0b79082783b80552b373a68283012928df56f522"dependencies = [+ "brotli","flate2","futures-core","memchr",@@ -1453,6 +1469,27 @@ dependencies = ["cfg_aliases",]+[[package]]+name = "brotli"+version = "7.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cc97b8f16f944bba54f0433f07e30be199b6dc2bd25937444bbad560bcea29bd"+dependencies = [+ "alloc-no-stdlib",+ "alloc-stdlib",+ "brotli-decompressor",+]++[[package]]+name = "brotli-decompressor"+version = "4.0.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a334ef7c9e23abf0ce748e8cd309037da93e606ad52eb372e4ce327a0dcfbdfd"+dependencies = [+ "alloc-no-stdlib",+ "alloc-stdlib",+]+[[package]]name = "bstr"version = "1.11.3"diff --git a/rust/cloud-storage/document_storage_service/Cargo.toml b/rust/cloud-storage/document_storage_service/Cargo.tomlindex ef45fad092..fe5448613d 100644--- a/rust/cloud-storage/document_storage_service/Cargo.toml+++ b/rust/cloud-storage/document_storage_service/Cargo.toml@@ -42,6 +42,7 @@ clap = { workspace = true }cloudfront_sign = { workspace = true }comms_service_client = { path = "../comms_service_client" }connection_gateway = { path = "../connection_gateway" }+document_sub_type = { path = "../document_sub_type" }dynamodb_client = { path = "../dynamodb_client" }email = { path = "../email", features = ["outbound", "ports"] }email_service_client = { path = "../email_service_client" }@@ -103,14 +104,16 @@ system_properties = { path = "../system_properties" }thiserror = { workspace = true }tokio = { workspace = true }tower = { workspace = true }-tower-http = { workspace = true }+tower-http = { workspace = true, features = [+ "compression-br",+ "compression-gzip",+] }tracing = { workspace = true }urlencoding = { workspace = true }utoipa = { workspace = true, features = ["axum_extras"] }utoipa-swagger-ui = { workspace = true, features = ["axum"] }uuid = { workspace = true }zip = { workspace = true }-document_sub_type = { path = "../document_sub_type" }[dev-dependencies]cool_asserts = "2"diff --git a/rust/cloud-storage/document_storage_service/src/api/mod.rs b/rust/cloud-storage/document_storage_service/src/api/mod.rsindex 25813a2054..7d39542536 100644--- a/rust/cloud-storage/document_storage_service/src/api/mod.rs+++ b/rust/cloud-storage/document_storage_service/src/api/mod.rs@@ -53,10 +53,8 @@ pub static MACRO_INTERNAL_USER_ID_HEADER_KEY: &str = "x-document-storage-servicepub static MACRO_READ_PROFESSIONAL_PERMISSION_ID: &str = "read:professional_features";pub async fn setup_and_serve(state: ApiContext) -> anyhow::Result<()> {- let cors = macro_cors::cors_layer();-let app = api_router(state.clone())- .layer(cors.clone())+ .merge(health::router()).layer(ServiceBuilder::new().layer(TraceLayer::new_for_http())@@ -65,10 +63,11 @@ pub async fn setup_and_serve(state: ApiContext) -> anyhow::Result<()> {service_name: VersionedApiServiceName::DocumentStorageService,},validate_api_version,- )),+ ))+ .layer(macro_cors::cors_layer())+ .layer(CompressionLayer::new().gzip(true).br(true)),)// The health router is attached here so we don't attach the logging middleware to it- .merge(health::router().layer(cors)).merge(SwaggerUi::new("/docs").url("/api-doc/openapi.json", swagger::ApiDoc::openapi()));let listener = tokio::net::TcpListener::bind(format!("0.0.0.0:{}", state.config.port))diff --git a/rust/cloud-storage/email_service/Cargo.toml b/rust/cloud-storage/email_service/Cargo.tomlindex a85e4be33e..959ce69b4a 100644--- a/rust/cloud-storage/email_service/Cargo.toml+++ b/rust/cloud-storage/email_service/Cargo.toml@@ -111,7 +111,10 @@ system_properties = { path = "../system_properties" }thiserror = { workspace = true }tokio = { workspace = true }tower = { workspace = true }-tower-http = { workspace = true }+tower-http = { workspace = true, features = [+ "compression-br",+ "compression-gzip",+] }tracing = { workspace = true }url = { workspace = true }urlencoding = { workspace = true }diff --git a/rust/cloud-storage/email_service/src/api/mod.rs b/rust/cloud-storage/email_service/src/api/mod.rsindex 1454beb550..e02594b883 100644--- a/rust/cloud-storage/email_service/src/api/mod.rs+++ b/rust/cloud-storage/email_service/src/api/mod.rs@@ -2,7 +2,7 @@ use anyhow::Context;use axum::Router;use context::ApiContext;use tower::ServiceBuilder;-use tower_http::trace::TraceLayer;+use tower_http::{compression::CompressionLayer, trace::TraceLayer};use utoipa::OpenApi;use utoipa_swagger_ui::SwaggerUi;@@ -19,16 +19,18 @@ mod middleware;mod swagger;pub async fn setup_and_serve(state: ApiContext) -> anyhow::Result<()> {- let cors = macro_cors::cors_layer();-let env = state.config.environment;let port = state.config.port;let app = api_router(state.clone()).with_state(state)- .layer(cors.clone())- .layer(ServiceBuilder::new().layer(TraceLayer::new_for_http()))+ .merge(health::router())+ .layer(+ ServiceBuilder::new()+ .layer(TraceLayer::new_for_http())+ .layer(macro_cors::cors_layer())+ .layer(CompressionLayer::new().gzip(true).br(true)),+ )// The health router is attached here so we don't attach the logging middleware to it- .merge(health::router().layer(cors)).merge(SwaggerUi::new("/docs").url("/api-doc/openapi.json", swagger::ApiDoc::openapi()));let listener = tokio::net::TcpListener::bind(format!("0.0.0.0:{}", port))diff --git a/rust/cloud-storage/notification_service/Cargo.toml b/rust/cloud-storage/notification_service/Cargo.tomlindex 9d0834d251..3292a785b6 100644--- a/rust/cloud-storage/notification_service/Cargo.toml+++ b/rust/cloud-storage/notification_service/Cargo.toml@@ -72,7 +72,10 @@ sqs_worker = { path = "../sqs_worker" }thiserror = { workspace = true }tokio = { workspace = true }tower = { workspace = true }-tower-http = { workspace = true }+tower-http = { workspace = true, features = [+ "compression-br",+ "compression-gzip",+] }tracing = { workspace = true }url = { workspace = true }utoipa = { workspace = true }diff --git a/rust/cloud-storage/notification_service/src/api/mod.rs b/rust/cloud-storage/notification_service/src/api/mod.rsindex 72851a718b..c11b91fcce 100644--- a/rust/cloud-storage/notification_service/src/api/mod.rs+++ b/rust/cloud-storage/notification_service/src/api/mod.rs@@ -4,7 +4,7 @@ use axum::Router;use macro_middleware::auth::internal_access::ValidInternalKey;use model::version::{ServiceNameState, VersionedApiServiceName, validate_api_version};use tower::ServiceBuilder;-use tower_http::trace::TraceLayer;+use tower_http::{compression::CompressionLayer, trace::TraceLayer};use utoipa::OpenApi;use utoipa_swagger_ui::SwaggerUi;@@ -21,13 +21,11 @@ mod user_notification;mod swagger;pub async fn setup_and_serve(state: ApiContext) -> anyhow::Result<()> {- let cors = macro_cors::cors_layer();-let port = state.config.port;let env = state.config.environment;let app = api_router(state.clone()).with_state(state)- .layer(cors.clone())+ .merge(health::router()).layer(ServiceBuilder::new().layer(TraceLayer::new_for_http())@@ -36,10 +34,11 @@ pub async fn setup_and_serve(state: ApiContext) -> anyhow::Result<()> {service_name: VersionedApiServiceName::NotificationService,},validate_api_version,- )),+ ))+ .layer(macro_cors::cors_layer())+ .layer(CompressionLayer::new().gzip(true).br(true)),)// The health router is attached here so we don't attach the logging middleware to it- .merge(health::router().layer(cors)).merge(SwaggerUi::new("/docs").url("/api-doc/openapi.json", swagger::ApiDoc::openapi()));let listener = tokio::net::TcpListener::bind(format!("0.0.0.0:{}", port))