googleapis/gcp-metadata

Simplify fastFailMetadataRequest() logic

Closed this issue · 0 comments

bcoe commented

To address a bug with DNS lookup in some GCP environments, we introduced logic that attempts both the IP address and DNS lookup of metadata.google.internal..

This logic has been working well, but is a little crufty:

  • it seems like we could pull some of the logic used to build up constants into the global scope into a helper.
  • it feels like the replace logic, used to create the secondary URL lookup could also be simplified.

Now that we've also introduced the GCE_METADATA_IP (in #346) environment variable, it seems like a refactor is needed.