Skip to content

Commit

Permalink
More feature flags.
Browse files Browse the repository at this point in the history
  • Loading branch information
gmagnu committed Dec 28, 2024
1 parent a7c50c3 commit 2d8d644
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
public class S3SourceProvider extends StreamSourceProvider {

private static final boolean USE_CRT_CLIENT = Boolean.parseBoolean(System.getProperty("gor.s3.client.crt", "false"));
private static final boolean USE_NETTY_CLIENT = Boolean.parseBoolean(System.getProperty("gor.s3.client.netty", "true"));

private final Cache<String, S3Client> clientCache = CacheBuilder.newBuilder()
.expireAfterAccess(1, TimeUnit.HOURS)
Expand Down Expand Up @@ -222,14 +223,17 @@ private S3Client createApacheClient(Credentials cred) {
}

protected S3AsyncClient getAsyncClient(String securityContext, String bucket) throws IOException {
BundledCredentials creds = BundledCredentials.fromSecurityContext(securityContext);
return asyncClientCredCache.getClient(creds, bucket);
}

private S3AsyncClient createAsyncClient(Credentials cred) {
if (USE_CRT_CLIENT) {
return null; //createCrtAsyncClient(cred);
}
if (USE_NETTY_CLIENT) {
BundledCredentials creds = BundledCredentials.fromSecurityContext(securityContext);
return asyncClientCredCache.getClient(creds, bucket);
}
return null;
}

private S3AsyncClient createAsyncClient(Credentials cred) {
return createNettyClient(cred);
}

Expand Down

0 comments on commit 2d8d644

Please sign in to comment.