Skip to content

fix: do not call GCECredentials::onGCE if ADC has already checked#422

Merged
bshaffer merged 5 commits intomainfrom
add-set-is-on-gce
Oct 25, 2022
Merged

fix: do not call GCECredentials::onGCE if ADC has already checked#422
bshaffer merged 5 commits intomainfrom
add-set-is-on-gce

Conversation

@bshaffer
Copy link
Copy Markdown
Contributor

@bshaffer bshaffer commented Oct 21, 2022

Adds a method GCECredentials::setIsOnGce, so that if ApplicationDefaultCredentials already checks that the library is running on GCE, we do not need to check again in GCECredentials.

if (ApplicationDefaultCredentials::onGce()) {
    $creds = new GCECredentials();
    $creds->setIsOnGce(true); // save the credentials a trip to the metadata server
}

@bshaffer bshaffer requested a review from a team October 21, 2022 18:48
@bshaffer bshaffer changed the title fix: do not call fix: do not call GCECrentials::onGCE if ADC has already checked Oct 21, 2022
@bshaffer bshaffer changed the title fix: do not call GCECrentials::onGCE if ADC has already checked fix: do not call GCECredentials::onGCE if ADC has already checked Oct 21, 2022
@bshaffer bshaffer requested a review from dwsupplee October 25, 2022 17:37
Copy link
Copy Markdown
Contributor

@dwsupplee dwsupplee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just also raising up the PHPStan failure if you'd like to address that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants