Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Commit

Permalink
feat: Support get CREDENTIAL_ENV_NAME from properties (#782)
Browse files Browse the repository at this point in the history
This closes #781.

Signed-off-by: tison <wander4096@gmail.com>

Signed-off-by: tison <wander4096@gmail.com>
  • Loading branch information
tisonkun authored Nov 23, 2022
1 parent ee64ef7 commit 2bb7d57
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,11 @@ protected ServiceOptions(
quotaProjectId =
builder.quotaProjectId != null
? builder.quotaProjectId
: getValueFromCredentialsFile(System.getenv(CREDENTIAL_ENV_NAME), "quota_project_id");
: getValueFromCredentialsFile(getCredentialsPath(), "quota_project_id");
}

private static String getCredentialsPath() {
return System.getProperty(CREDENTIAL_ENV_NAME, System.getenv(CREDENTIAL_ENV_NAME));
}

/**
Expand Down Expand Up @@ -511,7 +515,7 @@ static boolean headerContainsMetadataFlavor(HttpResponse response) {
}

protected static String getServiceAccountProjectId() {
return getValueFromCredentialsFile(System.getenv(CREDENTIAL_ENV_NAME), "project_id");
return getValueFromCredentialsFile(getCredentialsPath(), "project_id");
}

@InternalApi("Visible for testing")
Expand Down

0 comments on commit 2bb7d57

Please sign in to comment.