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

feat: Support get CREDENTIAL_ENV_NAME from properties #782

Merged
merged 1 commit into from
Nov 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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