-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Update server.js #617
Update server.js #617
Conversation
`/computeMetadata/v1/instance/network-interfaces` is not support in standard.
Codecov Report
@@ Coverage Diff @@
## master #617 +/- ##
=======================================
Coverage 48.52% 48.52%
=======================================
Files 1 1
Lines 68 68
=======================================
Hits 33 33
Misses 35 35 Continue to review full report at Codecov.
|
@@ -22,31 +22,32 @@ const request = require('got'); | |||
const app = express(); | |||
app.enable('trust proxy'); | |||
|
|||
const METADATA_NETWORK_INTERFACE_URL = 'http://metadata/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip'; | |||
const METADATA_PROJECT_ID_URL = 'http://metadata.google.internal/computeMetadata/' + |
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.
Nit: can this be on one line? (You may have to add an // eslint-disable
at the end of it if you get linter issues.)
const options = { | ||
headers: { | ||
'Metadata-Flavor': 'Google' | ||
}, | ||
json: true | ||
json: false |
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.
Nit: do we need to explicitly specify this?
.then((response) => response.body) | ||
.catch((err) => { | ||
if (err && err.statusCode !== 200) { | ||
console.log('Error while talking to metadata server, assuming localhost'); | ||
return 'localhost'; | ||
console.log('Error while talking to metadata server, assuming UnknownProjectID'); |
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.
Could we use a more obvious default value? Or perhaps throw an error outright?
@ace-n Updated as requested, thanks :) |
* build!: Update library to use Node 12 Co-authored-by: Summer Ji <[email protected]> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
* build!: Update library to use Node 12 Co-authored-by: Summer Ji <[email protected]> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- ## [4.1.0](googleapis/nodejs-dataproc@v4.0.1...v4.1.0) (2022-09-22) ### Features * Add support for Dataproc metric configuration ([#626](googleapis/nodejs-dataproc#626)) ([79a4958](googleapis/nodejs-dataproc@79a4958)) * Support regapic LRO ([350626e](googleapis/nodejs-dataproc@350626e)) ### Bug Fixes * Allow passing gax instance to client constructor ([#612](googleapis/nodejs-dataproc#612)) ([caba80a](googleapis/nodejs-dataproc@caba80a)) * **deps:** Do not depend on protobufjs ([#607](googleapis/nodejs-dataproc#607)) ([4b62ef6](googleapis/nodejs-dataproc@4b62ef6)) * **deps:** Roll back dependency @google-cloud/dataproc to ^4.0.0 ([#627](googleapis/nodejs-dataproc#627)) ([e1c6d8b](googleapis/nodejs-dataproc@e1c6d8b)) * Do not import the whole google-gax from proto JS ([#1553](https://github.com/googleapis/nodejs-dataproc/issues/1553)) ([#617](googleapis/nodejs-dataproc#617)) ([2e2bea1](googleapis/nodejs-dataproc@2e2bea1)) * Preserve default values in x-goog-request-params header ([#620](googleapis/nodejs-dataproc#620)) ([484a023](googleapis/nodejs-dataproc@484a023)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release *beep* *boop* --- ## [4.1.0](googleapis/nodejs-dataproc@v4.0.1...v4.1.0) (2022-09-22) ### Features * Add support for Dataproc metric configuration ([#626](googleapis/nodejs-dataproc#626)) ([79a4958](googleapis/nodejs-dataproc@79a4958)) * Support regapic LRO ([350626e](googleapis/nodejs-dataproc@350626e)) ### Bug Fixes * Allow passing gax instance to client constructor ([#612](googleapis/nodejs-dataproc#612)) ([caba80a](googleapis/nodejs-dataproc@caba80a)) * **deps:** Do not depend on protobufjs ([#607](googleapis/nodejs-dataproc#607)) ([4b62ef6](googleapis/nodejs-dataproc@4b62ef6)) * **deps:** Roll back dependency @google-cloud/dataproc to ^4.0.0 ([#627](googleapis/nodejs-dataproc#627)) ([e1c6d8b](googleapis/nodejs-dataproc@e1c6d8b)) * Do not import the whole google-gax from proto JS ([#1553](https://github.com/googleapis/nodejs-dataproc/issues/1553)) ([#617](googleapis/nodejs-dataproc#617)) ([2e2bea1](googleapis/nodejs-dataproc@2e2bea1)) * Preserve default values in x-goog-request-params header ([#620](googleapis/nodejs-dataproc#620)) ([484a023](googleapis/nodejs-dataproc@484a023)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
/computeMetadata/v1/instance/network-interfaces
is not support in standard.