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(
350350 /* * URL to reach object store at. */
351351 val endpoint : String ,
352352 /* * Access token for writing data with. */
353- val accessToken : String ,
353+ val accessToken : String? ,
354354 /* * Secret key belonging to access token. */
355- val secretKey : String ,
355+ val secretKey : String? ,
356356 /* * Bucket name. */
357357 val bucket : String ,
358358 /* * If no endOffset is in the filename, read it from object tags. */
359359 val endOffsetFromTags : Boolean = false ,
360360) {
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()
365368
366369 fun withEnv (prefix : String ): S3Config = this
367370 .copyEnv(" ${prefix} S3_ACCESS_TOKEN" ) { copy(accessToken = it) }
You can’t perform that action at this time.
0 commit comments