You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/04/20 02:36:33 UTC
[GitHub] [incubator-pinot] phuchuynh9994 commented on a change in pull request #6809: Support GCS default service-account for PinotFS Plugin
phuchuynh9994 commented on a change in pull request #6809:
URL: https://github.com/apache/incubator-pinot/pull/6809#discussion_r616301172
##########
File path: pinot-plugins/pinot-file-system/pinot-gcs/src/main/java/org/apache/pinot/plugin/filesystem/GcsPinotFS.java
##########
@@ -63,20 +63,21 @@
@Override
public void init(PinotConfiguration config) {
- LOGGER.info("Configs are: {}, {}",
- PROJECT_ID,
- config.getProperty(PROJECT_ID));
+ Credentials credentials;
- checkArgument(!isNullOrEmpty(config.getProperty(PROJECT_ID)));
- checkArgument(!isNullOrEmpty(config.getProperty(GCP_KEY)));
- String projectId = config.getProperty(PROJECT_ID);
- String gcpKey = config.getProperty(GCP_KEY);
try {
- storage = StorageOptions.newBuilder()
- .setProjectId(projectId)
- .setCredentials(GoogleCredentials.fromStream(Files.newInputStream(Paths.get(gcpKey))))
- .build()
- .getService();
+ StorageOptions.Builder storageBuilder = StorageOptions.newBuilder();
+ if (!isNullOrEmpty(config.getProperty(PROJECT_ID)) && !isNullOrEmpty(config.getProperty(GCP_KEY))) {
+ LOGGER.info("Configs are: {}, {}", PROJECT_ID, config.getProperty(PROJECT_ID));
+ String projectId = config.getProperty(PROJECT_ID);
+ String gcpKey = config.getProperty(GCP_KEY);
+ storageBuilder.setProjectId(projectId);
Review comment:
PROJECT_ID is a part of service account.
I think in passing credentials manually way, we dont need PROOECT_ID also.
Ref doc: https://cloud.google.com/docs/authentication/production#linux-or-macos
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org