Skip to content

Commit

Permalink
Merge pull request #84 from kovstas/force-global-bucket-access-param
Browse files Browse the repository at this point in the history
Add S3_FORCE_GLOBAL_BUCKET_ACCESS environment variable
  • Loading branch information
tpunder authored Sep 25, 2024
2 parents 833eb1a + 58b2c36 commit 3aa2e89
Showing 1 changed file with 5 additions and 2 deletions.
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)

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

0 comments on commit 3aa2e89

Please sign in to comment.