Skip to content

Commit 6e9e86d

Browse files
committed
S3_ENDPOINT supports http/https
1 parent 116dc39 commit 6e9e86d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

tensorflow_io/core/plugins/s3/s3_filesystem.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,6 @@ static Aws::Client::ClientConfiguration& GetDefaultClientConfig() {
135135
absl::MutexLock l(&cfg_lock);
136136

137137
if (!init) {
138-
const char* endpoint = getenv("S3_ENDPOINT");
139-
if (endpoint) cfg.endpointOverride = Aws::String(endpoint);
140138
const char* region = getenv("AWS_REGION");
141139
// TODO (yongtang): `S3_REGION` should be deprecated after 2.0.
142140
if (!region) region = getenv("S3_REGION");
@@ -241,9 +239,13 @@ static void GetS3Client(tf_s3_filesystem::S3File* s3_file) {
241239
tf_s3_filesystem::AWSLogSystem::ShutdownAWSLogging();
242240
}
243241
});
242+
244243
int temp_value;
245244
if (absl::SimpleAtoi(getenv("S3_DISABLE_MULTI_PART_DOWNLOAD"), &temp_value))
246245
s3_file->use_multi_part_download = (temp_value != 1);
246+
247+
const char* endpoint = getenv("S3_ENDPOINT");
248+
if (endpoint) s3_file->s3_client->OverrideEndpoint(endpoint);
247249
}
248250
}
249251

tests/test_s3.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ def test_read_file():
5151
response = client.get_object(Bucket=bucket_name, Key=key_name)
5252
assert response["Body"].read() == body
5353

54-
os.environ["S3_ENDPOINT"] = "localhost:4566"
55-
os.environ["S3_USE_HTTPS"] = "0"
56-
os.environ["S3_VERIFY_SSL"] = "0"
54+
os.environ["S3_ENDPOINT"] = "http://localhost:4566"
5755

5856
content = tf.io.read_file("s3://{}/{}".format(bucket_name, key_name))
5957
assert content == body

0 commit comments

Comments
 (0)