File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
src/main/java/org/radarbase/output/config Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -350,18 +350,21 @@ data class S3Config(
350
350
/* * URL to reach object store at. */
351
351
val endpoint : String ,
352
352
/* * Access token for writing data with. */
353
- val accessToken : String ,
353
+ val accessToken : String? ,
354
354
/* * Secret key belonging to access token. */
355
- val secretKey : String ,
355
+ val secretKey : String? ,
356
356
/* * Bucket name. */
357
357
val bucket : String ,
358
358
/* * If no endOffset is in the filename, read it from object tags. */
359
359
val endOffsetFromTags : Boolean = false ,
360
360
) {
361
- fun createS3Client (): MinioClient = MinioClient .Builder ()
362
- .endpoint(endpoint)
363
- .credentials(accessToken, secretKey)
364
- .build()
361
+
362
+ fun createS3Client (): MinioClient = MinioClient .Builder ().apply {
363
+ endpoint(endpoint)
364
+ if (! accessToken.isNullOrBlank() && ! secretKey.isNullOrBlank()) {
365
+ credentials(accessToken, secretKey)
366
+ }
367
+ }.build()
365
368
366
369
fun withEnv (prefix : String ): S3Config = this
367
370
.copyEnv(" ${prefix} S3_ACCESS_TOKEN" ) { copy(accessToken = it) }
You can’t perform that action at this time.
0 commit comments