Skip to content

Commit

Permalink
Detect GAE std/flex with GAE_ENV, GAE_RUNTIME, GAE_VM. Non-compat is …
Browse files Browse the repository at this point in the history
…not app engine for our purposes.
  • Loading branch information
mattwhisenhunt authored and lesv committed Feb 16, 2018
1 parent 75ba03c commit a088a65
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.lang.reflect.InvocationTargetException;
import java.security.AccessControlException;
import java.util.Locale;
import java.util.Map;

/**
* {@link Beta} <br/>
Expand Down Expand Up @@ -257,10 +258,16 @@ private GoogleCredential getCredentialUsingWellKnownFile(
}

private boolean runningOnAppEngine() {
for (String envName : System.getenv().keySet()) {
if (envName.startsWith("GAE_")) {
return true;
}
Map<String, String> env = System.getenv();
if (env.containsKey("GAE_ENV") && env.get("GAE_VM").equals("standard")) {
return true;
}
if (env.containsKey("GAE_RUNTIME") &&
(env.get("GAE_RUNTIME").equals("java7") || env.get("GAE_RUNTIME").equals("java8"))) {
return true;
}
if (env.containsKey("GAE_VM") && env.get("GAE_VM") == "true") {
return true;
}
return false;
}
Expand Down

0 comments on commit a088a65

Please sign in to comment.