From d13a402319930908f6a65e3da59a9e45820bdf66 Mon Sep 17 00:00:00 2001 From: Tibor Leupold Date: Sat, 2 Mar 2024 15:35:34 -0800 Subject: [PATCH] Export the AWS_S3_ADDRESSING_STYLE setting This is to allow us to enable the "virtual" addressing style where the bucket name is part of the hostname. --- lpld/settings.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lpld/settings.py b/lpld/settings.py index 9fe7e1e..4094ec5 100644 --- a/lpld/settings.py +++ b/lpld/settings.py @@ -304,6 +304,22 @@ if "AWS_S3_ENDPOINT_URL" in os.environ: AWS_S3_ENDPOINT_URL = os.environ["AWS_S3_ENDPOINT_URL"] + # Specify the addressing style for the bucket. + # + # Possible values are: + # "virtual" - Bucket name is included in the hostname. + # "path" - Bucket name is included in the URI name. + # By default, Boto3 will attempt to use "virtual" and fallback to "path". + # See also: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html#using-a-configuration-file # noqa: E501 + # + # There is an oddity when you specify `AWS_S3_ENDPOINT_URL`. When the addressing + # style is manually set to "virtual", then the bucket name is injected as the first + # part of the endpoint host, with after the `//`. So, when combining "virtual" + # addressing style and the `AWS_S3_ENDPOINT_URL` setting, don't include the bucket + # name in the `AWS_S3_ENDPOINT_URL`. + if "AWS_S3_ADDRESSING_STYLE" in os.environ: + AWS_S3_ADDRESSING_STYLE = os.environ["AWS_S3_ADDRESSING_STYLE"] + # SECURITY