-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: use gcp-metadata #278
Conversation
package.json
Outdated
@@ -21,6 +21,7 @@ | |||
], | |||
"dependencies": { | |||
"axios": "^0.17.1", | |||
"gcp-metadata": "^0.4.1", |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/auth/computeclient.ts
Outdated
@@ -15,7 +15,7 @@ | |||
*/ | |||
|
|||
import {AxiosError, AxiosPromise, AxiosRequestConfig, AxiosResponse} from 'axios'; | |||
|
|||
import * as gcpMetadata from 'gcp-metadata'; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/auth/googleauth.ts
Outdated
} | ||
this.checkIsGCE = false; | ||
} | ||
this.checkIsGCE = await gcpMetadata.isAvailable(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/auth/googleauth.ts
Outdated
'http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/?recursive=true', | ||
headers: {'Metadata-Flavor': 'Google'} | ||
}); | ||
const res = await gcpMetadata.instance( |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
test/test.googleauth.ts
Outdated
'metadata-flavor': 'Google' | ||
}); | ||
const host = gcpMetadata.HOST_ADDRESS; | ||
const instancePath = '/computeMetadata/v1beta1/instance'; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -60,11 +61,15 @@ export class Compute extends OAuth2Client { | |||
*/ | |||
protected async refreshToken(refreshToken?: string| | |||
null): Promise<GetTokenResponse> { | |||
const url = this.tokenUrl || Compute._GOOGLE_OAUTH2_TOKEN_URL; | |||
const url = |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Codecov Report
@@ Coverage Diff @@
## master #278 +/- ##
==========================================
+ Coverage 91.33% 91.64% +0.31%
==========================================
Files 13 13
Lines 842 826 -16
Branches 185 177 -8
==========================================
- Hits 769 757 -12
+ Misses 73 69 -4
Continue to review full report at Codecov.
|
@ofrobots this is ready for a look 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
w/ nits
package.json
Outdated
@@ -21,6 +21,7 @@ | |||
], | |||
"dependencies": { | |||
"axios": "^0.17.1", | |||
"gcp-metadata": "^0.4.1", |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/auth/googleauth.ts
Outdated
} | ||
this.checkIsGCE = false; | ||
} | ||
this.checkIsGCE = await gcpMetadata.isAvailable(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
First draft of integrating the new and shiny gcp-metadata. First googleapis/gcp-metadata#24 needs to land, and we need to ship it :)
Resolves #190.