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
fix(local) local s3 (#1581)
Will Hutchinsonac302c953459
diff --git a/.env-local.enc b/.env-local.encindex c98654fb28..7417de8e50 100644--- a/.env-local.enc+++ b/.env-local.enc@@ -22,8 +22,8 @@ DOCUMENT_LIMIT=ENC[AES256_GCM,data:tc/RhbfR,iv:gT1V1tBq/K00a0kfc0G9jRbT4bX5+jDVMDOCUMENT_PERMISSION_JWT_SECRET_KEY=ENC[AES256_GCM,data:mnwKSvwdne50Lhfox+CjX8pNxxs9A8+BtFAxK4vnF4XXWWvUrYw=,iv:Tgh6u6vShcWTCtno6H+6PzEljujfommVN49JqjdkL9c=,tag:iIXMIw8oYQucEkvXdQUitg==,type:str]DOCUMENT_STORAGE_BUCKET=ENC[AES256_GCM,data:xsVAn85dO4mwjOyCLQ==,iv:n7mDXQkSPvTmBtfZFmxU6OJ4/Nc6K0R/amdQcW9895A=,tag:j2vAS2IF9w/DVCTN+BSwbw==,type:str]DOCUMENT_STORAGE_SERVICE_AUTH_KEY=ENC[AES256_GCM,data:Eddt7Y9QWw==,iv:YieY6ysNrUVYiZyLZqQIntfffGMTeyuuJQExQ2v+OGE=,tag:FPsHOdFGZ33D/HUuZRumhQ==,type:str]-DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_DISTRIBUTION_URL=ENC[AES256_GCM,data:QJ54Yvy+FGSiDOz+x1MGcRjDnKoo94LdjTpJHe5hz0g=,iv:eLJVpZ8fWjh3ac59Ha27lmpkenMjozPFzJeFAsOXDd0=,tag:DfUHPfOzVJ58wKQX0Y/Sfg==,type:str]-DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_SIGNER_PRIVATE_KEY_SECRET_NAME=ENC[AES256_GCM,data:CtckQcCi5v2NRhNbrCrUfpnGe/QiEhQUVP8toh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zn6A/g8Qiif9emNrO8SU2BZF13ZmUoazEd7/PwHGMz/i+RBI5s/Gf7peKddby+Lx/Hd7VOvDAR4C9hp3dQsZr2mOajnBwJDs1Glgj4+glKb6LP/4I8DqWq920pR6mS3tRoRDujk71Ox/EDo+U2SYeDihSaGYMfvR7S6Z26uYNGFXDk/qsOnVBPO4gXitRL72XYdqZ6zDxl7BnEtwgzu9c+/ocSCgeVgA1tHfchkkFuqxCssQ4m363fUAcx3VhcBT5SF5ElIKfxo9gWx7GuJhZ25c8T1CervB7zQPnp3qz6AIGKYx1Vnhykkjy6DklRtM/29ncDb7d2Za5ZAVeLr32WOn0Jm4ec1FtTKlvofYPTIEjVnr51XGst/MbVqYnL9+amjrmFe93/0WrIJmRL/VBMK51SCo5hiqANwbLAMKZy3Ibym1PZw==,iv:/LhgCeB0nPPYc3tPaZD2OM5JrIKUiIByftOi5bHFQos=,tag:N827MAMrChB4ai8cTcOVBQ==,type:str]DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_SIGNER_PUBLIC_KEY_ID=ENC[AES256_GCM,data:g9+n7a4bu3mz0/bKj3oi,iv:kIWOkEv9ZMRqi74b3ut2xKgijRxAQYIWfZ1wdZX/7BU=,tag:RGW+fWmC60QFZcZFVwsnwQ==,type:str]DOCUMENT_STORAGE_SERVICE_PRESIGNED_URL_BROWSER_CACHE_EXPIRY_SECONDS=ENC[AES256_GCM,data:+WQRJqA=,iv:hWYBOSKnIx9+hdnIo9vdroXi11faTRBD0gypnZCjhYw=,tag:Hxtu4x9QaGsF0sZWteYsSg==,type:str]DOCUMENT_STORAGE_SERVICE_PRESIGNED_URL_EXPIRY_SECONDS=ENC[AES256_GCM,data:doO3uyg=,iv:QZTnHo0ST1guMihGjuOQEuIlcaO3fU6RgDgLUJ0D9B0=,tag:0qOY/oe1LU8nX+Qf+/E0Mg==,type:str]@@ -118,7 +118,7 @@ sops_kms__list_1__map_arn=arn:aws:kms:us-west-1:569036502058:key/mrk-cab29bf9480sops_kms__list_1__map_aws_profile=sops_kms__list_1__map_created_at=2026-02-03T14:47:22Zsops_kms__list_1__map_enc=AQICAHjuYcSMsjB0lKJtZ3DIAvxF8N3RNRn5KZaAN74Et6122wGvSsy0EhK25Hy2hdoR6HqoAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQMHViQzKBwIGY72CWCAgEQgDtKthF4DIo1QiM2scSmXVBT624sUjTxO+jwAUipQ5Xc50oLOUa/tbaIiwNN1wE5AI48o8NPmyh2OoAeZw==-sops_lastmodified=2026-02-17T15:19:25Z-sops_mac=ENC[AES256_GCM,data:zMPl9adRKLMyMy4hnICDHPFvxALWzE2FXOFV0HAlKTArQ9VBCM3gzPrZDIpJG+W/wMaoATVqX8nqP4D4WRQIv+uL6TQaRQgXzHV2uV93JlMMYVn21k87GiZfyJCrUses4zJ0164y/EDmGqgLHxAlQslhDrld16Qox97xuxK1bn4=,iv:zGbtMDMxTeqRHFV/AbMskMtcOZIieIV9jOj8w8vfgy8=,tag:4NOWe5wxX8HWE8qmmwBzVA==,type:str]+sops_lastmodified=2026-02-19T14:22:47Z+sops_mac=ENC[AES256_GCM,data:FVZrxa20dAh5Q0QDVTh6aQGJg2MZhnH3x9IxQvCU8D2XIbg4ZTJAmyX4f98vLAScKlfKwB/MxCdVEywg5/9f32ySR7zz37LhhxCeYfao7oJBQzohxr78ukbWCn2lW2ZdkVlyWnvbENWnMNSmOT1Quyj03OG3qBD3p3Kq4tco7mc=,iv:lo3575VKSWnENfoq0BIIdG/kFnQN+iqrwX0sx5ZACBY=,tag:H9ZAaMyR1a3w2CPqBERcHQ==,type:str]sops_unencrypted_suffix=_unencryptedsops_version=3.11.0diff --git a/local_stack.just b/local_stack.justindex 2e9535e165..5deb58e237 100644--- a/local_stack.just+++ b/local_stack.just@@ -74,6 +74,10 @@ create_local_buckets:aws --endpoint-url=http://localhost:4566 s3 mb s3://docx-upload || trueaws --endpoint-url=http://localhost:4566 s3 mb s3://static-file-storage || trueaws --endpoint-url=http://localhost:4566 s3 mb s3://bulk-upload-staging || true+ # Apply CORS configuration to all buckets+ for bucket in macro-email-attachments doc-storage docx-upload static-file-storage bulk-upload-staging; do \+ aws --endpoint-url=http://localhost:4566 s3api put-bucket-cors --bucket $bucket --cors-configuration '{"CORSRules":[{"AllowedOrigins":["http://localhost:3000"],"AllowedMethods":["GET","PUT","POST","DELETE","HEAD"],"AllowedHeaders":["*"],"ExposeHeaders":["ETag"],"MaxAgeSeconds":3600}]}' || true; \+ done@echo "S3 buckets created"# Full LocalStack setupdiff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lockindex a0ee90312e..627c926167 100644--- a/rust/cloud-storage/Cargo.lock+++ b/rust/cloud-storage/Cargo.lock@@ -2917,6 +2917,7 @@ dependencies = ["futures","http-body-util","lexical_client",+ "macro_aws_config","macro_db_migrator","macro_project_utils","macro_user_id",@@ -5118,6 +5119,7 @@ name = "macro_aws_config"version = "0.1.0"dependencies = ["aws-config",+ "aws-sdk-s3","macro_env","macro_env_var","thiserror 2.0.17",diff --git a/rust/cloud-storage/convert_service/Cargo.toml b/rust/cloud-storage/convert_service/Cargo.tomlindex 577dacac43..475b014838 100644--- a/rust/cloud-storage/convert_service/Cargo.toml+++ b/rust/cloud-storage/convert_service/Cargo.toml@@ -19,7 +19,7 @@ axum = { workspace = true }futures = { workspace = true }http-body-util = { workspace = true }lambda_client = { path = "../lambda_client" }-macro_aws_config = { path = "../macro_aws_config" }+macro_aws_config = { path = "../macro_aws_config", features = ["s3"] }macro_cors = { path = "../macro_cors" }macro_db_client = { path = "../macro_db_client" }macro_entrypoint = { path = "../macro_entrypoint" }diff --git a/rust/cloud-storage/convert_service/src/main.rs b/rust/cloud-storage/convert_service/src/main.rsindex d1cbea5223..df1571360d 100644--- a/rust/cloud-storage/convert_service/src/main.rs+++ b/rust/cloud-storage/convert_service/src/main.rs@@ -44,7 +44,7 @@ async fn main() -> anyhow::Result<()> {let queue_aws_config = macro_aws_config::get_macro_aws_config().await;- let s3_client = s3_client::S3::new(aws_sdk_s3::Client::new(&aws_config));+ let s3_client = s3_client::S3::new(macro_aws_config::s3_client().await);tracing::trace!("initialized s3 client");let sqs_client = sqs_client::SQS::new(aws_sdk_sqs::Client::new(&queue_aws_config))diff --git a/rust/cloud-storage/dataloss_prevention_handler/Cargo.toml b/rust/cloud-storage/dataloss_prevention_handler/Cargo.tomlindex 3c2af7a1b7..e801c4248d 100644--- a/rust/cloud-storage/dataloss_prevention_handler/Cargo.toml+++ b/rust/cloud-storage/dataloss_prevention_handler/Cargo.toml@@ -8,7 +8,7 @@ version = "0.1.0"[dependencies]anyhow = { workspace = true }aws-sdk-s3 = { workspace = true }-macro_aws_config = { path = "../macro_aws_config" }+macro_aws_config = { path = "../macro_aws_config", features = ["s3"] }aws-sdk-sns = { workspace = true }aws_lambda_events = { workspace = true, features = ["s3"] }lambda_runtime = { workspace = true }diff --git a/rust/cloud-storage/dataloss_prevention_handler/src/main.rs b/rust/cloud-storage/dataloss_prevention_handler/src/main.rsindex bd1f94b21d..167a3f4f24 100644--- a/rust/cloud-storage/dataloss_prevention_handler/src/main.rs+++ b/rust/cloud-storage/dataloss_prevention_handler/src/main.rs@@ -16,7 +16,7 @@ async fn main() -> Result<(), Error> {let aws_config = macro_aws_config::get_macro_aws_config().await;- let s3_client = s3_client::S3::new(aws_sdk_s3::Client::new(&aws_config));+ let s3_client = s3_client::S3::new(macro_aws_config::s3_client().await);tracing::trace!("initialized s3 client");let sns_client = sns_client::SNS::new(aws_sdk_sns::Client::new(&aws_config));diff --git a/rust/cloud-storage/delete_document_worker/Cargo.toml b/rust/cloud-storage/delete_document_worker/Cargo.tomlindex 6c584211bc..976a7b0325 100644--- a/rust/cloud-storage/delete_document_worker/Cargo.toml+++ b/rust/cloud-storage/delete_document_worker/Cargo.toml@@ -11,7 +11,7 @@ local_queue = [][dependencies]anyhow = { workspace = true }aws-sdk-s3 = { workspace = true }-macro_aws_config = { path = "../macro_aws_config" }+macro_aws_config = { path = "../macro_aws_config", features = ["s3"] }aws-sdk-secretsmanager = { workspace = true }aws-sdk-sqs = { workspace = true }axum = { workspace = true }diff --git a/rust/cloud-storage/delete_document_worker/src/main.rs b/rust/cloud-storage/delete_document_worker/src/main.rsindex b2a0773047..a144ba3faa 100644--- a/rust/cloud-storage/delete_document_worker/src/main.rs+++ b/rust/cloud-storage/delete_document_worker/src/main.rs@@ -42,7 +42,7 @@ pub async fn main() -> anyhow::Result<()> {let aws_config = macro_aws_config::get_macro_aws_config().await;- let s3_client = s3_client::S3::new(aws_sdk_s3::Client::new(&aws_config));+ let s3_client = s3_client::S3::new(macro_aws_config::s3_client().await);let delete_document_worker = sqs_worker::SQSWorker::new(aws_sdk_sqs::Client::new(&aws_config),diff --git a/rust/cloud-storage/document_storage_service/Cargo.toml b/rust/cloud-storage/document_storage_service/Cargo.tomlindex a1eebce9f6..fb42ebd48a 100644--- a/rust/cloud-storage/document_storage_service/Cargo.toml+++ b/rust/cloud-storage/document_storage_service/Cargo.toml@@ -60,7 +60,7 @@ http-body-util = { workspace = true }jsonwebtoken = { workspace = true }lazy_static = { workspace = true }macro_auth = { path = "../macro_auth" }-macro_aws_config = { path = "../macro_aws_config" }+macro_aws_config = { path = "../macro_aws_config", features=["s3"] }macro_axum_utils = { path = "../macro_axum_utils" }macro_cors = { path = "../macro_cors" }macro_db_client = { path = "../macro_db_client" }diff --git a/rust/cloud-storage/document_storage_service/src/api/documents/location.rs b/rust/cloud-storage/document_storage_service/src/api/documents/location.rsindex f7446ec4fa..d8404ed0c1 100644--- a/rust/cloud-storage/document_storage_service/src/api/documents/location.rs+++ b/rust/cloud-storage/document_storage_service/src/api/documents/location.rs@@ -429,7 +429,12 @@ pub(in crate::api::documents) fn get_presigned_url() -> anyhow::Result<String> {let constructed_url = format!("{}/{}", cloudfront_distribution_url, key);- let signed_url = get_signed_url(&constructed_url, options)?;+ let signed_url = if !macro_aws_config::is_local_aws() {+ get_signed_url(&constructed_url, options)?+ } else {+ constructed_url+ };+Ok(signed_url)}diff --git a/rust/cloud-storage/document_storage_service/src/main.rs b/rust/cloud-storage/document_storage_service/src/main.rsindex c6d6e9a712..a5333b404b 100644--- a/rust/cloud-storage/document_storage_service/src/main.rs+++ b/rust/cloud-storage/document_storage_service/src/main.rs@@ -112,7 +112,7 @@ async fn main() -> anyhow::Result<()> {);tracing::trace!("initialized dynamodb client");- let s3_client = aws_sdk_s3::Client::new(&aws_config);+ let s3_client = macro_aws_config::s3_client().await;tracing::trace!("initialized s3 client");diff --git a/rust/cloud-storage/document_text_extractor/Cargo.toml b/rust/cloud-storage/document_text_extractor/Cargo.tomlindex 327540958e..f34d52bc06 100644--- a/rust/cloud-storage/document_text_extractor/Cargo.toml+++ b/rust/cloud-storage/document_text_extractor/Cargo.toml@@ -13,7 +13,7 @@ macos = []ai = { path = "../ai" }anyhow = { workspace = true }aws-sdk-s3 = { workspace = true }-macro_aws_config = { path = "../macro_aws_config" }+macro_aws_config = { path = "../macro_aws_config", features = ["s3"] }aws_lambda_events = { workspace = true, features = ["eventbridge","s3",diff --git a/rust/cloud-storage/document_text_extractor/src/main.rs b/rust/cloud-storage/document_text_extractor/src/main.rsindex 590ab80ebb..3ddab264a4 100644--- a/rust/cloud-storage/document_text_extractor/src/main.rs+++ b/rust/cloud-storage/document_text_extractor/src/main.rs@@ -43,9 +43,7 @@ async fn main() -> Result<(), Error> {tracing::trace!("initialized db client");- let aws_config = macro_aws_config::get_macro_aws_config().await;-- let s3_client = service::s3::S3::new(aws_sdk_s3::Client::new(&aws_config));+ let s3_client = service::s3::S3::new(macro_aws_config::s3_client().await);tracing::trace!("initialized s3 client");// Set which pdfium binary to usediff --git a/rust/cloud-storage/documents/Cargo.toml b/rust/cloud-storage/documents/Cargo.tomlindex 5948d35606..6a99afd2c5 100644--- a/rust/cloud-storage/documents/Cargo.toml+++ b/rust/cloud-storage/documents/Cargo.toml@@ -44,6 +44,7 @@ entity_access = { path = "../entity_access" }macro_user_id = { path = "../macro_user_id" }model = { path = "../model" }models_permissions = { path = "../models_permissions" }+macro_aws_config = { path = "../macro_aws_config" }# Async runtime (for ports)tokio = { workspace = true, optional = true }diff --git a/rust/cloud-storage/documents/src/domain/service.rs b/rust/cloud-storage/documents/src/domain/service.rsindex f8ea2bd3eb..2a9bfd8f8c 100644--- a/rust/cloud-storage/documents/src/domain/service.rs+++ b/rust/cloud-storage/documents/src/domain/service.rs@@ -66,7 +66,13 @@ impl<R: DocumentRepo> DocumentServiceImpl<R> {fn make_presigned_url(&self, key: &str) -> anyhow::Result<String> {let constructed_url = format!("{}/{}", self.cloudfront_config.distribution_url, key);let options = self.get_signed_options();- let signed_url = get_signed_url(&constructed_url, &options)?;++ let signed_url = if !macro_aws_config::is_local_aws() {+ get_signed_url(&constructed_url, &options)?+ } else {+ constructed_url+ };+Ok(signed_url)}diff --git a/rust/cloud-storage/docx_unzip_handler/Cargo.toml b/rust/cloud-storage/docx_unzip_handler/Cargo.tomlindex ced30fd6c7..79e991d2be 100644--- a/rust/cloud-storage/docx_unzip_handler/Cargo.toml+++ b/rust/cloud-storage/docx_unzip_handler/Cargo.toml@@ -8,7 +8,7 @@ version = "0.1.0"[dependencies]anyhow = { workspace = true }aws-sdk-lambda = { workspace = true }-macro_aws_config = { path = "../macro_aws_config" }+macro_aws_config = { path = "../macro_aws_config", features = ["s3"] }aws-sdk-s3 = { workspace = true }aws-sdk-sqs = { workspace = true }aws-smithy-types = { workspace = true }diff --git a/rust/cloud-storage/docx_unzip_handler/src/main.rs b/rust/cloud-storage/docx_unzip_handler/src/main.rsindex e5e431e2aa..a63218cfc5 100644--- a/rust/cloud-storage/docx_unzip_handler/src/main.rs+++ b/rust/cloud-storage/docx_unzip_handler/src/main.rs@@ -42,7 +42,7 @@ async fn main() -> Result<(), Error> {let aws_config = macro_aws_config::get_macro_aws_config().await;- let s3_client = s3_client::S3::new(aws_sdk_s3::Client::new(&aws_config));+ let s3_client = s3_client::S3::new(macro_aws_config::s3_client().await);tracing::trace!("initialized s3 client");let lambda_client = lambda_client::Lambda::new(aws_sdk_lambda::Client::new(&aws_config));diff --git a/rust/cloud-storage/email_service/Cargo.toml b/rust/cloud-storage/email_service/Cargo.tomlindex 558933cc13..0ab3019fb1 100644--- a/rust/cloud-storage/email_service/Cargo.toml+++ b/rust/cloud-storage/email_service/Cargo.toml@@ -67,7 +67,7 @@ sfs_delete = []ammonia = "4.1.0"anyhow = { workspace = true }authentication_service_client = { path = "../authentication_service_client" }-macro_aws_config = { path = "../macro_aws_config" }+macro_aws_config = { path = "../macro_aws_config", features = ["s3"] }aws-sdk-s3 = { workspace = true }aws-sdk-secretsmanager = { workspace = true }aws-sdk-sqs = { workspace = true }diff --git a/rust/cloud-storage/email_service/src/bin/pubsub_workers/pubsub_workers.rs b/rust/cloud-storage/email_service/src/bin/pubsub_workers/pubsub_workers.rsindex c36ca64005..e413cb1c45 100644--- a/rust/cloud-storage/email_service/src/bin/pubsub_workers/pubsub_workers.rs+++ b/rust/cloud-storage/email_service/src/bin/pubsub_workers/pubsub_workers.rs@@ -20,7 +20,7 @@ async fn main() -> anyhow::Result<()> {let aws_config = macro_aws_config::get_macro_aws_config().await;- let s3_client = s3_client::S3::new(aws_sdk_s3::Client::new(&aws_config));+ let s3_client = s3_client::S3::new(macro_aws_config::s3_client().await);let secretsmanager_client = secretsmanager_client::SecretsManager::new(aws_sdk_secretsmanager::Client::new(&aws_config),diff --git a/rust/cloud-storage/email_service/src/main.rs b/rust/cloud-storage/email_service/src/main.rsindex 15d231ecee..636424a953 100644--- a/rust/cloud-storage/email_service/src/main.rs+++ b/rust/cloud-storage/email_service/src/main.rs@@ -25,7 +25,7 @@ async fn main() -> anyhow::Result<()> {let aws_config = macro_aws_config::get_macro_aws_config().await;- let s3_client = s3_client::S3::new(aws_sdk_s3::Client::new(&aws_config));+ let s3_client = s3_client::S3::new(macro_aws_config::s3_client().await);let secretsmanager_client = secretsmanager_client::SecretsManager::new(aws_sdk_secretsmanager::Client::new(&aws_config),diff --git a/rust/cloud-storage/macro_aws_config/Cargo.toml b/rust/cloud-storage/macro_aws_config/Cargo.tomlindex b237e996f5..1b13d89fee 100644--- a/rust/cloud-storage/macro_aws_config/Cargo.toml+++ b/rust/cloud-storage/macro_aws_config/Cargo.toml@@ -4,6 +4,9 @@ name = "macro_aws_config"publish = falseversion = "0.1.0"+[features]+s3 = ["dep:aws-sdk-s3"]+[dependencies]aws-config = { workspace = true }macro_env = { path = "../macro_env" }@@ -11,3 +14,4 @@ macro_env_var = { path = "../macro_env_var" }thiserror = { workspace = true }tracing = { workspace = true }url = { workspace = true }+aws-sdk-s3 = { workspace = true, optional = true }diff --git a/rust/cloud-storage/macro_aws_config/src/lib.rs b/rust/cloud-storage/macro_aws_config/src/lib.rsindex a856b5d4ce..c1cab2e089 100644--- a/rust/cloud-storage/macro_aws_config/src/lib.rs+++ b/rust/cloud-storage/macro_aws_config/src/lib.rs@@ -10,6 +10,15 @@ maybe_env_var! {pub struct LocalAwsUrl;}+/// Creates an S3 client+#[cfg(feature = "s3")]+pub async fn s3_client() -> aws_sdk_s3::Client {+ let s3_config = aws_sdk_s3::config::Builder::from(&get_macro_aws_config().await)+ .force_path_style(is_local_aws())+ .build();+ aws_sdk_s3::Client::from_conf(s3_config)+}+/// Creates a aws_config to use./// If you provide `LOCAL_AWS_URL` environment variable we create a local aws/// config with test credentials.diff --git a/rust/cloud-storage/search_processing_service/Cargo.toml b/rust/cloud-storage/search_processing_service/Cargo.tomlindex aed79c6e8a..c8e754f15e 100644--- a/rust/cloud-storage/search_processing_service/Cargo.toml+++ b/rust/cloud-storage/search_processing_service/Cargo.toml@@ -32,7 +32,7 @@ email_db_client = { path = "../email_db_client" }futures = { workspace = true }http-body-util = { workspace = true }lexical_client = { path = "../lexical_client" }-macro_aws_config = { path = "../macro_aws_config" }+macro_aws_config = { path = "../macro_aws_config", features = ["s3"] }macro_cors = { path = "../macro_cors" }macro_db_client = { path = "../macro_db_client", optional = true } # Make this optionalmacro_entrypoint = { path = "../macro_entrypoint" }diff --git a/rust/cloud-storage/search_processing_service/src/main.rs b/rust/cloud-storage/search_processing_service/src/main.rsindex 3d660e35b0..cf536b3c63 100644--- a/rust/cloud-storage/search_processing_service/src/main.rs+++ b/rust/cloud-storage/search_processing_service/src/main.rs@@ -37,7 +37,7 @@ async fn main() -> anyhow::Result<()> {let sqs_client = sqs_client::SQS::new(aws_sdk_sqs::Client::new(&aws_config)).search_event_queue(&config.search_event_queue);- let s3_client = s3_client::S3::new(aws_sdk_s3::Client::new(&aws_config));+ let s3_client = s3_client::S3::new(macro_aws_config::s3_client().await);let secretsmanager_client = secretsmanager_client::SecretsManager::new(aws_sdk_secretsmanager::Client::new(&aws_config),diff --git a/rust/cloud-storage/seed_cli/Cargo.toml b/rust/cloud-storage/seed_cli/Cargo.tomlindex 6c1e8ea3ea..e2ec5204f3 100644--- a/rust/cloud-storage/seed_cli/Cargo.toml+++ b/rust/cloud-storage/seed_cli/Cargo.toml@@ -29,7 +29,7 @@ chrono = { workspace = true }rand = { workspace = true }futures = { workspace = true }macro_db_client = { path = "../macro_db_client" }-macro_aws_config = {path = "../macro_aws_config" }+macro_aws_config = {path = "../macro_aws_config", features = ["s3"] }aws-sdk-s3 = { workspace = true }models_permissions = { path = "../models_permissions" }diff --git a/rust/cloud-storage/seed_cli/justfile b/rust/cloud-storage/seed_cli/justfileindex 10085a51cb..416b65d75f 100644--- a/rust/cloud-storage/seed_cli/justfile+++ b/rust/cloud-storage/seed_cli/justfile@@ -6,6 +6,9 @@ get_environment:just ../../../infra/stacks/fusionauth-instance/insert_local_fusionauth_variables@echo "Copying env file"cp ../../../.env ./+ @echo "Overriding LOCAL_AWS_URL"+ sed -i '' 's|^LOCAL_AWS_URL=.*|LOCAL_AWS_URL="http://localhost:4566"|' .env+[positional-arguments]seed *ARGS:- cargo r {{ ARGS }}+ cargo r "$@"diff --git a/rust/cloud-storage/seed_cli/src/main.rs b/rust/cloud-storage/seed_cli/src/main.rsindex 1bf65945ac..4a5fdaf3f8 100644--- a/rust/cloud-storage/seed_cli/src/main.rs+++ b/rust/cloud-storage/seed_cli/src/main.rs@@ -60,17 +60,12 @@ pub async fn main() -> anyhow::Result<()> {);tracing::trace!("initialized fusionauth client");- let aws_config = macro_aws_config::get_macro_aws_config().await;- let s3_config = aws_sdk_s3::config::Builder::from(&aws_config)- .force_path_style(macro_aws_config::is_local_aws())- .build();-let context = SeedCliContext {db: Db::new(db),fusionauth_client: Auth::new(fusionauth_client),s3: S3::new(&env_vars.document_storage_bucket,- aws_sdk_s3::Client::from_conf(s3_config),+ macro_aws_config::s3_client().await,),};diff --git a/rust/cloud-storage/sha_cleanup_worker/Cargo.toml b/rust/cloud-storage/sha_cleanup_worker/Cargo.tomlindex 8a4d6064d4..9c34fc153e 100644--- a/rust/cloud-storage/sha_cleanup_worker/Cargo.toml+++ b/rust/cloud-storage/sha_cleanup_worker/Cargo.toml@@ -11,7 +11,7 @@ redis_client_test = [][dependencies]anyhow = { workspace = true }aws-sdk-s3 = { workspace = true }-macro_aws_config = { path = "../macro_aws_config" }+macro_aws_config = { path = "../macro_aws_config", features = ["s3"] }futures = { workspace = true }macro_entrypoint = { path = "../macro_entrypoint" }macro_env = { path = "../macro_env" }diff --git a/rust/cloud-storage/sha_cleanup_worker/src/main.rs b/rust/cloud-storage/sha_cleanup_worker/src/main.rsindex f29af96fdc..8b2b92a14a 100644--- a/rust/cloud-storage/sha_cleanup_worker/src/main.rs+++ b/rust/cloud-storage/sha_cleanup_worker/src/main.rs@@ -12,7 +12,7 @@ async fn main() -> Result<(), anyhow::Error> {let config = Config::from_env().context("all necessary env vars should be available")?;let s3_client = service::s3::S3::new(- aws_sdk_s3::Client::new(¯o_aws_config::get_macro_aws_config().await),+ macro_aws_config::s3_client().await,&config.document_storage_bucket,);diff --git a/rust/cloud-storage/static_file_service/Cargo.toml b/rust/cloud-storage/static_file_service/Cargo.tomlindex 3f3c7d88e6..c40341bfb2 100644--- a/rust/cloud-storage/static_file_service/Cargo.toml+++ b/rust/cloud-storage/static_file_service/Cargo.toml@@ -26,7 +26,7 @@ aws-sdk-sqs.workspace = trueaxum = { workspace = true, features = ["tower-log", "ws"] }chrono = { workspace = true }macro_auth = { path = "../macro_auth" }-macro_aws_config = { path = "../macro_aws_config" }+macro_aws_config = { path = "../macro_aws_config", features = ["s3"] }macro_cors = { path = "../macro_cors" }macro_entrypoint = { path = "../macro_entrypoint" }macro_env = { path = "../macro_env" }diff --git a/rust/cloud-storage/static_file_service/src/api/mod.rs b/rust/cloud-storage/static_file_service/src/api/mod.rsindex 88032ecd90..34aa1d2e74 100644--- a/rust/cloud-storage/static_file_service/src/api/mod.rs+++ b/rust/cloud-storage/static_file_service/src/api/mod.rs@@ -34,7 +34,7 @@ pub async fn setup_and_serve(let metadata_client = DynamodbClient::new(&aws_config, config.dynamodb_table.clone());let sqs_client = aws_sdk_sqs::Client::new(&aws_config);- let inner_client = aws_sdk_s3::Client::new(&aws_config);+ let inner_client = macro_aws_config::s3_client().await;let storage_client = S3Client::new(inner_client, config.storage_bucket_name.clone());let state = AppState {