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

Add S3_FORCE_GLOBAL_BUCKET_ACCESS environment variable #84

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Changes from all 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
7 changes: 5 additions & 2 deletions src/main/scala/fm/sbt/S3URLHandler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,15 @@ final class S3URLHandler extends URLHandler {
} yield new EndpointConfiguration(serviceEndpoint, signingRegion)

// Path Style Access is deprecated by Amazon S3 but LocalStack seems to want to use it
val pathStyleAccess: Boolean = Option(System.getenv("S3_PATH_STYLE_ACCESS")).map{ _.toBoolean }.getOrElse(false)
val pathStyleAccess: Boolean = Option(System.getenv("S3_PATH_STYLE_ACCESS")).exists(_.toBoolean)

// Rerouting can cause replacing the user custom endpoint with the S3 default one (s3.amazonaws.com). Default is true
val forceGlobalBucketAccessEnabled: Boolean = Option(System.getenv("S3_FORCE_GLOBAL_BUCKET_ACCESS")).forall(_.toBoolean)
tpunder marked this conversation as resolved.
Show resolved Hide resolved

val tmp: AmazonS3ClientBuilder = AmazonS3Client.builder()
.withCredentials(getCredentialsProvider(bucket))
.withClientConfiguration(getProxyConfiguration)
.withForceGlobalBucketAccessEnabled(true)
.withForceGlobalBucketAccessEnabled(forceGlobalBucketAccessEnabled)
.withPathStyleAccessEnabled(pathStyleAccess)

// Only one of the endpointConfiguration or region can be set at a time.
Expand Down
Loading