Skip to content

Commit

Permalink
--amend
Browse files Browse the repository at this point in the history
  • Loading branch information
yiwei.wang committed Jul 21, 2023
1 parent 7e0db12 commit 10f9f68
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cpp/src/arrow/filesystem/s3fs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ using internal::ToAwsString;
using internal::ToURLEncodedAwsString;

static const char kSep = '/';
constexpr char kDefaultEndpointEnvVar[] = "AWS_ENDPOINT";
constexpr char kAwsEndpointUrlEnvVar[] = "AWS_ENDPOINT_URL";

// -----------------------------------------------------------------------
// S3ProxyOptions implementation
Expand Down Expand Up @@ -338,9 +338,9 @@ Result<S3Options> S3Options::FromUri(const Uri& uri, std::string* out_path) {
} else {
options.ConfigureDefaultCredentials();
}
auto endpoint_env = arrow::internal::GetEnvVar(kDefaultEndpointEnvVar);
if(endpoint_env.ok()) {
options.endpoint_override = endpoint_env.MoveValueUnsafe();
auto endpoint_env = arrow::internal::GetEnvVar(kAwsEndpointUrlEnvVar);
if (endpoint_env.ok()) {
options.endpoint_override = *endpoint_env;
}

bool region_set = false;
Expand Down
8 changes: 8 additions & 0 deletions cpp/src/arrow/filesystem/s3fs_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,14 @@ TEST_F(S3OptionsTest, FromUri) {

// Invalid option
ASSERT_RAISES(Invalid, S3Options::FromUri("s3://mybucket/?xxx=zzz", &path));

// Endpoint from environment variable
{
EnvVarGuard endpoint_guard("AWS_ENDPOINT_URL", "http://127.0.0.1:9000");
ASSERT_OK_AND_ASSIGN(options, S3Options::FromUri("s3://mybucket/", &path));
ASSERT_NE(options.endpoint_override, "http://127.0.0.1:9000");
}

}

TEST_F(S3OptionsTest, FromAccessKey) {
Expand Down

0 comments on commit 10f9f68

Please sign in to comment.