Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS_HTTPS support + fix missing scheme #476

Merged
merged 8 commits into from
Feb 4, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# unreleased

* add support for setting the S3 endpoint url scheme via the `AWS_HTTPS` environment variables in `aws_get_object` function using boto3 (https://github.com/cogeotiff/rio-tiler/pull/476)

# 3.0.3 (2022-01-18)

Expand Down
6 changes: 6 additions & 0 deletions rio_tiler/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ def aws_get_object(
if not client:
session = boto3_session()
endpoint_url = os.environ.get("AWS_S3_ENDPOINT", None)
if endpoint_url is not None:
vincentsarago marked this conversation as resolved.
Show resolved Hide resolved
use_https = os.environ.get("AWS_HTTPS", "YES")
if use_https == "YES":
emmanuelmathot marked this conversation as resolved.
Show resolved Hide resolved
endpoint_url = "https://" + endpoint_url
else:
endpoint_url = "http://" + endpoint_url
client = session.client("s3", endpoint_url=endpoint_url)

params = {"Bucket": bucket, "Key": key}
Expand Down