Skip to content

Commit

Permalink
Log an error when environment variables are unavailable for presigned…
Browse files Browse the repository at this point in the history
… url authentication
  • Loading branch information
gibber9809 committed Dec 20, 2024
1 parent 84bc5c3 commit 2a87da2
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions components/core/src/clp_s/ReaderUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,18 @@ std::shared_ptr<clp::ReaderInterface> try_create_file_reader(std::string_view co
}

bool try_sign_url(std::string& url) {
clp::aws::AwsAuthenticationSigner signer{
std::getenv(cAwsAccessKeyIdEnvVar),
std::getenv(cAwsSecretAccessKeyEnvVar)
};
auto const aws_access_key = std::getenv(cAwsAccessKeyIdEnvVar);
auto const aws_secret_access_key = std::getenv(cAwsSecretAccessKeyEnvVar);
if (nullptr == aws_access_key || nullptr == aws_secret_access_key) {
SPDLOG_ERROR(
"{} and {} environment variables not available for presigned url authentication.",
cAwsAccessKeyIdEnvVar,
cAwsSecretAccessKeyEnvVar
);
return false;
}

clp::aws::AwsAuthenticationSigner signer{aws_access_key, aws_secret_access_key};

try {
clp::aws::S3Url s3_url{url};
Expand Down

0 comments on commit 2a87da2

Please sign in to comment.