Skip to content

add environment detection helpers#8

Merged
stephenplusplus merged 1 commit intomasterfrom
spp--environments
Nov 23, 2016
Merged

add environment detection helpers#8
stephenplusplus merged 1 commit intomasterfrom
spp--environments

Conversation

@stephenplusplus
Copy link
Copy Markdown
Owner

@stephenplusplus stephenplusplus commented Nov 22, 2016

Inspired by googleapis/google-cloud-node#1808

This adds new helper methods to detect the environment an app is running in. Ideally, this will live in google-auth-library someday. At that time, these new methods can still exist, and will simply swap out where the legwork is taking place.

var auth = require('google-auto-auth')()

auth.getEnvironment(function(err, env) {
  env = {
    IS_APP_ENGINE: Boolean,
    IS_CLOUD_FUNCTION: Boolean,
    IS_COMPUTE_ENGINE: Boolean
  }
})

auth.isAppEngine(function(err, isAppEngine) {
  isAppEngine = Boolean
})

auth.isCloudFunction(function(err, isCloudFunction) {
  isCloudFunction = Boolean
})

auth.isComputeEngine(function(err, isComputeEngine) {
  isComputeEngine = Boolean
})

@stephenplusplus
Copy link
Copy Markdown
Owner Author

@jmdobry PTAL

@stephenplusplus stephenplusplus merged commit 3e1f8b6 into master Nov 23, 2016
@stephenplusplus stephenplusplus deleted the spp--environments branch November 23, 2016 11:48
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