ivankelly commented on a change in pull request #2151: GCS offload support(3): 
add configs to support GCS driver
URL: https://github.com/apache/incubator-pulsar/pull/2151#discussion_r204691136
 
 

 ##########
 File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/offload/impl/BlobStoreManagedLedgerOffloader.java
 ##########
 @@ -143,23 +189,35 @@ public static BlobStoreManagedLedgerOffloader 
create(ServiceConfiguration conf,
 
         ContextBuilder contextBuilder = ContextBuilder.newBuilder(driver);
 
-        AWSCredentials credentials = null;
-        try {
-            DefaultAWSCredentialsProviderChain creds = 
DefaultAWSCredentialsProviderChain.getInstance();
-            credentials = creds.getCredentials();
-        } catch (Exception e) {
-            log.error("Exception when get credentials for s3 ", e);
-        }
-
+        // credentials:
+        //   for s3, get by DefaultAWSCredentialsProviderChain.
+        //   for gcs, use downloaded file 'google_creds.json', which contains 
service account key by
+        //     following instructions in page 
https://support.google.com/googleapi/answer/6158849
         String id = "accesskey";
         String key = "secretkey";
-        if (credentials != null) {
-            id = credentials.getAWSAccessKeyId();
-            key = credentials.getAWSSecretKey();
+        if (isS3Driver(driver)) {
 
 Review comment:
   We shouldn't have AWS/GCS specific logic in this class. Instead, it should 
be in the factory method, maybe broken out into a utility method called from 
the factory method. Then the id & key should be passed in as parameters to the 
constructor of this class.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to