Skip to content

Commit cf6ac54

Browse files
committed
First look for AE's project id, then GOOGLE_APPLICATION_CREDENTIALS'
1 parent 3be6174 commit cf6ac54

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ Most `gcloud-java` libraries require a project ID. There are multiple ways to s
8383

8484
1. Project ID supplied when building the service options
8585
2. Project ID specified by the environment variable `GCLOUD_PROJECT`
86-
3. Project ID specified in the JSON credentials file pointed by the `GOOGLE_APPLICATION_CREDENTIALS` environment variable
87-
4. App Engine project ID
86+
3. App Engine project ID
87+
4. Project ID specified in the JSON credentials file pointed by the `GOOGLE_APPLICATION_CREDENTIALS` environment variable
8888
5. Google Cloud SDK project ID
8989
6. Compute Engine project ID
9090

gcloud-java-core/src/main/java/com/google/gcloud/ServiceOptions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,10 +383,10 @@ protected String defaultHost() {
383383
protected String defaultProject() {
384384
String projectId = System.getProperty(PROJECT_ENV_NAME, System.getenv(PROJECT_ENV_NAME));
385385
if (projectId == null) {
386-
projectId = serviceAccountProjectId();
386+
projectId = appEngineProjectId();
387387
}
388388
if (projectId == null) {
389-
projectId = appEngineProjectId();
389+
projectId = serviceAccountProjectId();
390390
}
391391
return projectId != null ? projectId : googleCloudProjectId();
392392
}

0 commit comments

Comments
 (0)