In a Node.js script, How can I check if I'm running in Google Cloud VM or locally?
I'm not using Google App Engine.
Is it possible to do this without making any network requests, synchronously?
In a Node.js script, How can I check if I'm running in Google Cloud VM or locally?
I'm not using Google App Engine.
Is it possible to do this without making any network requests, synchronously?
You could, for example, check for the various environment variables that will be set, such as GOOGLE_CLOUD_PROJECT or GAE_INSTANCE, accessible from a Node.js script as:
process.env.GOOGLE_CLOUD_PROJECT