From c9d2458718d259ff0be7e510bb3a961e9209749d Mon Sep 17 00:00:00 2001 From: messense Date: Thu, 7 Dec 2023 16:01:40 +0800 Subject: [PATCH] fix: fix `AWS_EC2_METADATA_DISABLED` logic error (#393) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤦‍♂️ --- src/aws/credential.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/aws/credential.rs b/src/aws/credential.rs index ea6b38b7..06b957ac 100644 --- a/src/aws/credential.rs +++ b/src/aws/credential.rs @@ -80,9 +80,11 @@ pub struct DefaultLoader { impl DefaultLoader { /// Create a new CredentialLoader pub fn new(client: Client, config: Config) -> Self { - let imds_v2_loader = config - .ec2_metadata_disabled - .then(|| IMDSv2Loader::new(client.clone())); + let imds_v2_loader = if config.ec2_metadata_disabled { + None + } else { + Some(IMDSv2Loader::new(client.clone())) + }; Self { client, config,